aboutsummaryrefslogtreecommitdiff
path: root/qlop.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-01-29 00:52:10 -0500
committerMike Frysinger <vapier@gentoo.org>2016-01-29 00:52:10 -0500
commit7aff0263204d80304108dbe4f0061f44ed8f189f (patch)
tree6fa4dfaa0bbf9ead25d25c4eb41361d6847a5d71 /qlop.c
parentqcheck: improve error reporting for unreadable files (diff)
downloadportage-utils-7aff0263204d80304108dbe4f0061f44ed8f189f.tar.gz
portage-utils-7aff0263204d80304108dbe4f0061f44ed8f189f.tar.bz2
portage-utils-7aff0263204d80304108dbe4f0061f44ed8f189f.zip
qlop: fix crash w/corrupted log files
If a file is truncated/corrupted, make sure we don't read past the end of the valid buffer. URL: https://bugs.gentoo.org/573106 Reported-by: Agostino Sarubbo <ago@gentoo.org>
Diffstat (limited to 'qlop.c')
-rw-r--r--qlop.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/qlop.c b/qlop.c
index 546c3531..bb324743 100644
--- a/qlop.c
+++ b/qlop.c
@@ -265,6 +265,9 @@ show_emerge_history(char listflag, int argc, char **argv, const char *logfile)
continue;
*p = 0;
q = p + 3;
+ /* Make sure there's leading white space and not a truncated string. #573106 */
+ if (p[1] != ' ' || p[2] != ' ')
+ continue;
t = (time_t) atol(buf);