diff options
author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2016-10-03 22:06:23 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2016-10-06 14:56:39 +0200 |
commit | b56b13684e01ab56738e602b35a2c133e8f9b92a (patch) | |
tree | 640c7b4f3e88051c818ba4cb9b8e372c0349c051 | |
parent | 2571cf0f9bfa769bdf9c8fba25684fa0330a2b57 (diff) | |
download | util-linux-b56b13684e01ab56738e602b35a2c133e8f9b92a.tar.gz |
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.
-rw-r--r-- | text-utils/rev.c | 3 |
1 files changed, 3 insertions, 0 deletions
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 */ |