regedit: Make sure NextLine+1 be in the range of buffer.

Jiaxing Wang hello.wjx at gmail.com
Thu May 21 06:16:41 CDT 2015


From 828e82105b6dd22e2ae4507e5eb968876eae3f26 Mon Sep 17 00:00:00 2001
From: Jiaxing Wang <hello.wjx at gmail.com>
Date: Thu, 21 May 2015 16:49:45 +0800
Subject: regedit: Make sure NextLine+1 be in the range of buffer.

When the buffer is full as [..., '\\', '\r', 0] or [..., '\\', '\n', 0]
then NextLine would point to the last 0, and NextLine+1 would beyond the
buffer.
---
 programs/regedit/regproc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 2d766de..df17d74 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -849,7 +849,7 @@ static void processRegLinesW(FILE *in)
                 if(*s_eol == '\r' && *(s_eol+1) == '\n')
                     NextLine++;
 
-                while(*(NextLine+1) == ' ' || *(NextLine+1) == '\t')
+                while(NextLine+1 < buf+lineSize && (*(NextLine+1) == ' ' || *(NextLine+1) == '\t'))
                     NextLine++;
 
                 MoveMemory(s_eol - 1, NextLine, (CharsInBuf - (NextLine - s) + 1)*sizeof(WCHAR));
-- 
1.9.1



More information about the wine-patches mailing list