rev: Avoid out of boundary read

Check if the length of the parsed string is at least 1,
otherwise an out of boundary read would occur.
This commit is contained in:
Tobias Stoeckmann 2016-10-03 22:06:23 +02:00 committed by Karel Zak
parent 2571cf0f9b
commit b56b13684e
1 changed files with 3 additions and 0 deletions

View File

@ -149,6 +149,9 @@ int main(int argc, char *argv[])
while (fgetws(buf, bufsiz, fp)) {
len = wcslen(buf);
if (len == 0)
continue;
/* This is my hack from setpwnam.c -janl */
while (buf[len-1] != '\n' && !feof(fp)) {
/* Extend input buffer if it failed getting the whole line */