Author: ion
Date: Mon Feb 20 06:37:13 2012
New Revision: 55733

URL: http://svn.reactos.org/svn/reactos?rev=55733&view=rev
Log:
[RTL]: Force RtlIpToString APIs to behave inexplicably like on Windows, 
returning -1 instead of crashing when sprintfing to a NULL pointer.

Modified:
    trunk/reactos/lib/rtl/network.c

Modified: trunk/reactos/lib/rtl/network.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/network.c?rev=55733&r1=55732&r2=55733&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/network.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/network.c [iso-8859-1] Mon Feb 20 06:37:13 2012
@@ -32,6 +32,8 @@
                         OUT PCHAR S)
 {
     INT Length;
+    
+    if (!S) return (LPSTR)~0;
 
     Length = sprintf(S, "%u.%u.%u.%u", Addr->S_un.S_un_b.s_b1,
                                             Addr->S_un.S_un_b.s_b2,
@@ -85,6 +87,8 @@
 {
     INT Length;
 
+    if (!S) return (LPWSTR)~0;
+    
     Length = swprintf(S, L"%u.%u.%u.%u", Addr->S_un.S_un_b.s_b1,
                                          Addr->S_un.S_un_b.s_b2,
                                          Addr->S_un.S_un_b.s_b3,


Reply via email to