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



The information in this article applies to:

  • Microsoft Windows CE 2.0 for the Handheld PC

This article was previously published under Q189127

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;
   }
				

Modification Type:MajorLast Reviewed:10/11/2002
Keywords:kbbug KB189127