commit:     7aff0263204d80304108dbe4f0061f44ed8f189f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 29 05:52:10 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 05:52:10 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7aff0263

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 <AT> gentoo.org>

 qlop.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qlop.c b/qlop.c
index 546c353..bb32474 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);
 

Reply via email to