Skip to contentSkip to conversation

rev: Avoid out of boundary read

PATCH Applied Tobias Stoeckmann 2 participants 2 messages Oct 3, 2016 – Oct 6, 2016 Util-Linux package

lore
Share & tools
lore
#0 lore raw

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
index ace2cd6..735aaef 100644
@@ -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
maintainer Applied
#1 lore raw
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