* [PATCH] rev: Avoid out of boundary read
@ 2016-10-03 20:06 Tobias Stoeckmann
2016-10-06 12:59 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Stoeckmann @ 2016-10-03 20:06 UTC (permalink / raw)
To: util-linux
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(+)
diff --git a/text-utils/rev.c b/text-utils/rev.c
index ace2cd6..735aaef 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 */
--
2.10.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rev: Avoid out of boundary read
2016-10-03 20:06 [PATCH] rev: Avoid out of boundary read Tobias Stoeckmann
@ 2016-10-06 12:59 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2016-10-06 12:59 UTC (permalink / raw)
To: Tobias Stoeckmann; +Cc: util-linux
On Mon, Oct 03, 2016 at 10:06:23PM +0200, Tobias Stoeckmann wrote:
> 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.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-06 13:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-03 20:06 [PATCH] rev: Avoid out of boundary read Tobias Stoeckmann
2016-10-06 12:59 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox