From 62930b0461c4919a31b55ec6f590afddbe0b2b35 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Mon, 20 Feb 2012 06:37:13 +0000 Subject: [PATCH] [RTL]: Force RtlIpToString APIs to behave inexplicably like on Windows, returning -1 instead of crashing when sprintfing to a NULL pointer. svn path=/trunk/; revision=55733 --- reactos/lib/rtl/network.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/lib/rtl/network.c b/reactos/lib/rtl/network.c index d3b4a9881e1..f870c65e024 100644 --- a/reactos/lib/rtl/network.c +++ b/reactos/lib/rtl/network.c @@ -32,6 +32,8 @@ RtlIpv4AddressToStringA(IN struct in_addr *Addr, 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 @@ RtlIpv4AddressToStringW(IN struct in_addr *Addr, { 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,