Module: wine Branch: master Commit: 2a9713a6cb8cc41db5a7001201ad4793b82d93cf URL: http://source.winehq.org/git/wine.git/?a=commit;h=2a9713a6cb8cc41db5a7001201...
Author: Alexander Nicolaysen Sørnes alex@thehandofagony.com Date: Fri Jul 11 13:21:17 2008 +0200
regedit: Null-terminate buffer in Unicode file import.
---
programs/regedit/regproc.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 98fd8b1..a716f3d 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -737,11 +737,12 @@ void processRegLinesW(FILE *in) }
/* Get as much as possible into the buffer, terminated either by - * eof, error, eol or getting the maximum amount. Abort on error. + * eof, error or getting the maximum amount. Abort on error. */ size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining);
- check = fread(s, sizeof(WCHAR), size_to_get, in); + check = fread(s, sizeof(WCHAR), size_to_get - 1, in); + s[check] = 0;
if (check == 0) { if (ferror(in)) { @@ -762,6 +763,9 @@ void processRegLinesW(FILE *in) { s_eol = strchrW(s, '\n');
+ if(!s_eol) + break; + /* If it is a comment line then discard it and go around again */ if (*s == '#') { s = s_eol + 1;