From b56b13684e01ab56738e602b35a2c133e8f9b92a Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Mon, 3 Oct 2016 22:06:23 +0200 Subject: 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(+) (limited to 'text-utils/rev.c') diff --git a/text-utils/rev.c b/text-utils/rev.c index ace2cd6a6..735aaef3d 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 */ -- cgit v1.2.3-55-g7522