- Also fixed unintialised value bug in interface routes
return -1;
}
- if( Index > Buffer->nSubBuffers )
+ if( Index >= Buffer->nSubBuffers )
{
// Appended buffers
Index -= Buffer->nSubBuffers;
}
else
{
- Index = Buffer->nSubBuffers - Index;
+ int rv = Index + 1;
+ Index = Buffer->nSubBuffers - Index - 1;
// Prepended buffers
*DataPtr = Buffer->SubBuffers[Index].Data;
*Length = Buffer->SubBuffers[Index].PreLength;
- return Buffer->nSubBuffers - (Index - 1);
+ return rv;
}
}
iface->Next = NULL;
iface->Type = 0; // Unset type
iface->Address = iface->Name + nameLen + 1; // Address
+ memset(&iface->Route, 0, sizeof(iface->Route));
iface->Route.Network = iface->Address + IPStack_GetAddressSize(-1);
iface->Route.NextHop = iface->Route.Network + IPStack_GetAddressSize(-1);