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:
parent
2571cf0f9b
commit
b56b13684e
|
@ -149,6 +149,9 @@ int main(int argc, char *argv[])
|
||||||
while (fgetws(buf, bufsiz, fp)) {
|
while (fgetws(buf, bufsiz, fp)) {
|
||||||
len = wcslen(buf);
|
len = wcslen(buf);
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* This is my hack from setpwnam.c -janl */
|
/* This is my hack from setpwnam.c -janl */
|
||||||
while (buf[len-1] != '\n' && !feof(fp)) {
|
while (buf[len-1] != '\n' && !feof(fp)) {
|
||||||
/* Extend input buffer if it failed getting the whole line */
|
/* Extend input buffer if it failed getting the whole line */
|
||||||
|
|
Loading…
Reference in New Issue