BUG: inet_addr() with NULL Address Causes CE Device to Crash

ID: Q189127

The information in this article applies to:

SYMPTOMS

If you pass NULL into inet_addr(), it might crash on some Windows CE devices. It does not crash in emulation on the desktop.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

   #include <windows.h>
   #include <winsock.h>

   int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR
                      lpCmdLine, int nCmdShow)
   {
       if(inet_addr("1.2.3.4") != INADDR_NONE)
         MessageBox(NULL,_T("\"1.2.3.4\" okay"),NULL,MB_OK);
      else
         MessageBox(NULL,_T("\"1.2.3.4\" failed"),NULL,MB_OK);

       if(inet_addr("") != INADDR_NONE)
         MessageBox(NULL,_T("\"\" okay"),NULL,MB_OK);
      else
         MessageBox(NULL,_T("\"\" failed"),NULL,MB_OK);

   // crashes on device
       if(inet_addr(NULL) != INADDR_NONE)
         MessageBox(NULL,_T("NULL okay"),NULL,MB_OK);
      else
         MessageBox(NULL,_T("NULL failed"),NULL,MB_OK);

      return 0;
   }

Additional query words:
Keywords          : kbWinCE 
Issue type        : kbbug
Solution Type     : kbpending

Last Reviewed: September 3, 1998