Commit in reactos/lib/advapi32/reg on ros-branch-0_2_5
reg.c+9-21.65 -> 1.65.2.1
Don't write outside buffer

reactos/lib/advapi32/reg
reg.c 1.65 -> 1.65.2.1
diff -u -r1.65 -r1.65.2.1
--- reg.c	18 Dec 2004 22:54:37 -0000	1.65
+++ reg.c	26 Dec 2004 23:35:27 -0000	1.65.2.1
@@ -1,4 +1,4 @@
-/* $Id: reg.c,v 1.65 2004/12/18 22:54:37 gvg Exp $
+/* $Id: reg.c,v 1.65.2.1 2004/12/26 23:35:27 gvg Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -2506,7 +2506,14 @@
 	}
       else if (ErrorCode == ERROR_SUCCESS && ValueData.Buffer != NULL)
 	{
-	  RtlMoveMemory(lpData, ValueData.Buffer, Length);
+          if (*lpcbData < Length)
+            {
+              ErrorCode = ERROR_MORE_DATA;
+            }
+          else
+            {
+              RtlMoveMemory(lpData, ValueData.Buffer, Length);
+            }
 	}
 
       if (lpcbData != NULL)
CVSspam 0.2.8