Author: cgutman
Date: Wed Aug 29 14:23:40 2012
New Revision: 57199
URL: http://svn.reactos.org/svn/reactos?rev=57199&view=rev
Log:
[WS2_32]
- Fix a memory overwrite bug in some crappy WINE code that leads to nasty memory corruption of the service cache entry. This corrupts the first field of the cache, causing it to always reallocate memory because it thinks the size is 0. This would be even worse if the code didn't overwrite the other 12 bytes of corruption with proper data on the next lines. This also caused the aliases value to be garbage because it pointed at uninitialized data.
Modified:
trunk/reactos/dll/win32/ws2_32/misc/ns.c
Modified: trunk/reactos/dll/win32/ws2_32/misc/ns.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/ns.c…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] Wed Aug 29 14:23:40 2012
@@ -1275,7 +1275,7 @@
WS_DbgPrint(MAX_TRACE,("Aliase %d: %s\n", i, Aliases[i]));
}
- memcpy(p->Getservbyname,
+ memcpy(p->Getservbyname->Aliases,
Aliases,
sizeof(Aliases));
@@ -1457,7 +1457,7 @@
WS_DbgPrint(MAX_TRACE,("Aliases %d: %s\n", i, Aliases[i]));
}
- memcpy(p->Getservbyport,Aliases,sizeof(Aliases));
+ memcpy(p->Getservbyport->Aliases,Aliases,sizeof(Aliases));
/* Create the struct proper */
p->Getservbyport->ServerEntry.s_name = ServiceName;