Author: tfaber
Date: Wed Oct 12 11:58:46 2011
New Revision: 54093
URL:
http://svn.reactos.org/svn/reactos?rev=54093&view=rev
Log:
[RTL]
- Handle a NULL buffer in RtlIpv4AddressToStringA as Windows does. Fixes crash in
ntdll:rtl test
[CRT]
- Fail on qsort with 0 size. Fixes hang in ntdll:string test
Modified:
trunk/reactos/lib/rtl/network.c
trunk/reactos/lib/sdk/crt/stdlib/qsort.c
Modified: trunk/reactos/lib/rtl/network.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/network.c?rev=5409…
==============================================================================
--- trunk/reactos/lib/rtl/network.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/network.c [iso-8859-1] Wed Oct 12 11:58:46 2011
@@ -22,10 +22,15 @@
RtlIpv4AddressToStringA(IN struct in_addr *Addr,
OUT PCHAR S)
{
- return S + sprintf(S, "%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,
- Addr->S_un.S_un_b.s_b4);
+ CHAR Buffer[sizeof("255.255.255.255")];
+ INT Length;
+ Length = sprintf(Buffer, "%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,
+ Addr->S_un.S_un_b.s_b4);
+ if (S)
+ strcpy(S, Buffer);
+ return S + Length;
}
/*
Modified: trunk/reactos/lib/sdk/crt/stdlib/qsort.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/qsort.c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdlib/qsort.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdlib/qsort.c [iso-8859-1] Wed Oct 12 11:58:46 2011
@@ -186,7 +186,8 @@
if (n <= 1)
return;
- size = size;
+ if (size == 0)
+ return;
compar = compar;
thresh = size * THRESH;
max = base + n * size;