From: Tobias Stoeckmann Date: Mon, 3 Oct 2016 20:06:23 +0000 (+0200) Subject: rev: Avoid out of boundary read X-Git-Tag: v2.29-rc2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b56b13684e01ab56738e602b35a2c133e8f9b92a;p=thirdparty%2Futil-linux.git 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. --- diff --git a/text-utils/rev.c b/text-utils/rev.c index ace2cd6a6b..735aaef3d9 100644 --- a/text-utils/rev.c +++ b/text-utils/rev.c @@ -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 */