BUG: GetBestRoute Hangs Windows 98 if Invalid Pointer Is Passed

ID: Q193909

The information in this article applies to:

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          : kbnetwork kbAPI kbSDKPlatform kbWinOS98bug kbIPHelp kbGrpNet 
Issue type        : kbbug

Last Reviewed: October 10, 1998