- 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

svn path=/trunk/; revision=54093
This commit is contained in:
Thomas Faber 2011-10-12 11:58:46 +00:00
parent 0f71d87a65
commit b98f465c6d
2 changed files with 11 additions and 5 deletions

View file

@ -22,10 +22,15 @@ NTAPI
RtlIpv4AddressToStringA(IN struct in_addr *Addr, RtlIpv4AddressToStringA(IN struct in_addr *Addr,
OUT PCHAR S) OUT PCHAR S)
{ {
return S + sprintf(S, "%u.%u.%u.%u", Addr->S_un.S_un_b.s_b1, CHAR Buffer[sizeof("255.255.255.255")];
Addr->S_un.S_un_b.s_b2, INT Length;
Addr->S_un.S_un_b.s_b3, Length = sprintf(Buffer, "%u.%u.%u.%u", Addr->S_un.S_un_b.s_b1,
Addr->S_un.S_un_b.s_b4); 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;
} }
/* /*

View file

@ -186,7 +186,8 @@ qsort(void *base0, size_t n, size_t size, int (__cdecl *compar)(const void*, con
if (n <= 1) if (n <= 1)
return; return;
size = size; if (size == 0)
return;
compar = compar; compar = compar;
thresh = size * THRESH; thresh = size * THRESH;
max = base + n * size; max = base + n * size;