regedit: Need 3 bytes of room at end of buffer for \r\n\0 to avoid endless loop.
authorJiaxing Wang <hello.wjx@gmail.com>
Thu, 26 Nov 2015 04:22:40 +0000 (05:22 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 26 Nov 2015 14:58:28 +0000 (23:58 +0900)
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
programs/regedit/regproc.c

index 643b559f4f1f29c2b27bdd883444c3e6ab6e176d..2d766de96383b259c6f528eec781abfdb1450fb4 100644 (file)
@@ -641,7 +641,7 @@ static void processRegLinesA(FILE *in, char* first_chars)
             /* Do we need to expand the buffer ? */
             assert (s >= line && s <= line + lineSize);
             size_remaining = lineSize - (s-line);
-            if (size_remaining < 2) /* room for 1 character and the \0 */
+            if (size_remaining < 3) /* need at least 3 bytes of room for \r\n\0 */
             {
                 char *new_buffer;
                 size_t new_size = lineSize + REG_VAL_BUF_SIZE;