Commit 2a9713a6 authored by Alexander Nicolaysen Sørnes's avatar Alexander Nicolaysen Sørnes Committed by Alexandre Julliard

regedit: Null-terminate buffer in Unicode file import.

parent e4b1abef
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment