BUG: GetBestRoute Hangs Windows 98 if Invalid Pointer Is Passed
Article ID: 193909
Article Last Modified on 7/11/2005
APPLIES TO
- Microsoft Platform Software Development Kit-January 2000 Edition, when used with:
- Microsoft Windows 98 Standard Edition
This article was previously published under Q193909
SYMPTOMS
If you call the GetBestRoute API and pass an invalid (non NULL) value for
pBestRoute, a pointer to the MIB_IPFORWARDROW structure might cause Windows
98 to hang. You have to restart your computer.
If you call the API with pBestRoute == NULL, the API returns
ERROR_INVALID_PARAMETER, which is expected behavior.
RESOLUTION
This API should never be called with an uninitialized pointer. Either
initialize the pointer to NULL, assign it the value returned by malloc or
new, or pass in the address of a MIB_IPFORWARDROW structure (the
recommended way as demonstrated below).
Sample Code
IPAddr DestAddress; // 4-byte unsigned int.
IPAddr SrcAddress; // 4-byte unsigned int.
MIB_IPFORWARDROW BestRoute; // Route structure to get the route.
// Assign the proper destination and source address to
// DestAddress and SrcAddress.
// Pass the address of BestRoute to GetBestRoute, thus ensuring
// a valid address is passed to the API.
status = GetBestRoute(DestAddress, SrcAddress, &BestRoute)
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
Additional query words: IPHLPAPI
Keywords: kbbug kbapi kbiphelp kbnetwork KB193909