[WS2_32_NEW]
authorThomas Faber <thomas.faber@reactos.org>
Mon, 9 May 2016 07:34:46 +0000 (07:34 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 9 May 2016 07:34:46 +0000 (07:34 +0000)
- Add missing null termination for the line buffer in GetProtoGetNextEnt. Patch by Víctor Martínez Calvo. CID 716700
CORE-11218 #resolve

svn path=/trunk/; revision=71292

reactos/dll/win32/ws2_32_new/src/getproto.c

index fdf6219..5cfca6e 100644 (file)
@@ -72,7 +72,7 @@ GetProtoOpenNetworkDatabase(PCHAR Name)
                       NULL,
                       OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL,
                       NULL,
                       OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL,
-                      NULL); 
+                      NULL);
 }
 
 PCHAR
 }
 
 PCHAR
@@ -118,6 +118,9 @@ GetProtoGetNextEnt(IN HANDLE DbHandle,
                       &Read,
                       NULL)) return NULL;
 
                       &Read,
                       NULL)) return NULL;
 
+        /* Null terminate LineBuffer */
+        Buffer->LineBuffer[Read] = ANSI_NULL;
+
         /* Find out where the line ends */
         p1 = Buffer->LineBuffer;
         p = strchr(Buffer->LineBuffer, '\n');
         /* Find out where the line ends */
         p1 = Buffer->LineBuffer;
         p = strchr(Buffer->LineBuffer, '\n');
@@ -212,7 +215,7 @@ getprotobynumber(IN INT number)
     PWSTHREAD Thread;
     INT ErrorCode;
     PPROTOENT Protoent;
     PWSTHREAD Thread;
     INT ErrorCode;
     PPROTOENT Protoent;
-    PVOID GetProtoBuffer; 
+    PVOID GetProtoBuffer;
     HANDLE DbHandle;
     DPRINT("getprotobynumber: %lx\n", number);
 
     HANDLE DbHandle;
     DPRINT("getprotobynumber: %lx\n", number);
 
@@ -276,7 +279,7 @@ getprotobyname(IN CONST CHAR FAR *name)
     PWSTHREAD Thread;
     INT ErrorCode;
     PPROTOENT Protoent;
     PWSTHREAD Thread;
     INT ErrorCode;
     PPROTOENT Protoent;
-    PVOID GetProtoBuffer; 
+    PVOID GetProtoBuffer;
     HANDLE DbHandle;
     DPRINT("getprotobyname: %s\n", name);
 
     HANDLE DbHandle;
     DPRINT("getprotobyname: %s\n", name);