[ros-diffs] [cgutman] 40358: - Validate the buffer size before copying to it

cgutman at svn.reactos.org cgutman at svn.reactos.org
Sat Apr 4 02:41:43 CEST 2009


Author: cgutman
Date: Sat Apr  4 04:41:42 2009
New Revision: 40358

URL: http://svn.reactos.org/svn/reactos?rev=40358&view=rev
Log:
 - Validate the buffer size before copying to it

Modified:
    trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c

Modified: trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c?rev=40358&r1=40357&r2=40358&view=diff
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/datagram/datagram.c [iso-8859-1] Sat Apr  4 04:41:42 2009
@@ -126,6 +126,12 @@
                        ("Target Buffer: %x, Source Buffer: %x, Size %d\n",
                         Current->Buffer, DataBuffer, DataSize));
 
+          if (DataSize > Current->BufferSize)
+          {
+              Current->Complete(Current->Context, STATUS_BUFFER_TOO_SMALL, DataSize);
+              return;
+          }
+
           /* Copy the data into buffer provided by the user */
 	  RtlCopyMemory( Current->Buffer,
 			 DataBuffer,



More information about the Ros-diffs mailing list