regedit: Null-terminate buffer in Unicode file import.
This commit is contained in:
parent
e4b1abefdd
commit
2a9713a6cb
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue