[WS2_32]
authorThomas Faber <thomas.faber@reactos.org>
Mon, 20 Feb 2017 16:33:44 +0000 (16:33 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 20 Feb 2017 16:33:44 +0000 (16:33 +0000)
- Re-apply null termination fix in GetProtoGetNextEnt, which was lost in ws2_32_new work. CID 716700
CORE-11218

svn path=/trunk/; revision=73861

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

index ad69500..1f67cbd 100644 (file)
@@ -145,12 +145,13 @@ GetProtoGetNextEnt(IN HANDLE DbHandle,
         /* Read 512 bytes */
         if (!ReadFile(DbHandle,
                       Buffer->LineBuffer,
         /* Read 512 bytes */
         if (!ReadFile(DbHandle,
                       Buffer->LineBuffer,
-                      512,
+                      sizeof(Buffer->LineBuffer) - 1,
                       &Read,
                       NULL)) return NULL;
 
         /* Find out where the line ends */
         p1 = Buffer->LineBuffer;
                       &Read,
                       NULL)) return NULL;
 
         /* Find out where the line ends */
         p1 = Buffer->LineBuffer;
+        Buffer->LineBuffer[Read] = ANSI_NULL;
         p = strchr(Buffer->LineBuffer, '\n');
 
         /* Bail out if the file is parsed */
         p = strchr(Buffer->LineBuffer, '\n');
 
         /* Bail out if the file is parsed */
@@ -243,7 +244,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);
 
@@ -307,7 +308,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);