BUG: GetBestRoute Hangs Windows 98 if Invalid Pointer Is Passed (193909)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0, when used with:
    • the operating system: Microsoft Windows 98

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.

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbAPI kbBug kbIPHelp kbnetwork KB193909