regedit: Null-terminate buffer in Unicode file import.

This commit is contained in:
Alexander Nicolaysen Sørnes 2008-07-11 13:21:17 +02:00 committed by Alexandre Julliard
parent e4b1abefdd
commit 2a9713a6cb
1 changed files with 6 additions and 2 deletions

View File

@ -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;