rev: Avoid out of boundary read
PATCH 1/1 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.
--- text-utils/rev.c | 3 +++ 1 file changed, 3 insertions(+)
text-utils/rev.c +3 -0
@@ -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 */
Signature · 1 line
2.10.0
Quoted 5 lines · Tobias Stoeckmann
Check if the length of the parsed string is at least 1, otherwise an out of boundary read would occur.
--- text-utils/rev.c | 3 +++ 1 file changed, 3 insertions(+)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com