[ros-diffs] [cfinck] 36816: Allocate enough memory for Value (problem was spotted by Pigglesworth) This problem was revealed by r36797 (thanks to aicom, elhoir, Lone_Rifle and vicmarcal for the help with regression testing) Fixes ipconfig, ping and other network apps crashing with a buffer overflow.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sun Oct 19 00:22:10 CEST 2008


Author: cfinck
Date: Sat Oct 18 17:22:09 2008
New Revision: 36816

URL: http://svn.reactos.org/svn/reactos?rev=36816&view=rev
Log:
Allocate enough memory for Value (problem was spotted by Pigglesworth)
This problem was revealed by r36797 (thanks to aicom, elhoir, Lone_Rifle and vicmarcal for the help with regression testing)

Fixes ipconfig, ping and other network apps crashing with a buffer overflow.

Modified:
    trunk/reactos/dll/win32/iphlpapi/registry.c

Modified: trunk/reactos/dll/win32/iphlpapi/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/registry.c?rev=36816&r1=36815&r2=36816&view=diff
==============================================================================
--- trunk/reactos/dll/win32/iphlpapi/registry.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/iphlpapi/registry.c [iso-8859-1] Sat Oct 18 17:22:09 2008
@@ -50,7 +50,7 @@
   }
 
   ValueLen = MaxAdapterName;
-  Value = (PWCHAR)HeapAlloc( GetProcessHeap(), 0, MaxAdapterName );
+  Value = (PWCHAR)HeapAlloc( GetProcessHeap(), 0, MaxAdapterName * sizeof(WCHAR) );
   Status = RegEnumKeyExW( RegHandle, n, Value, &ValueLen,
 			  NULL, NULL, NULL, NULL );
   if (Status != ERROR_SUCCESS)



More information about the Ros-diffs mailing list