From: Craig Small Date: Thu, 9 Jul 2009 03:27:41 +0000 (+0000) Subject: off by one malloc prob in pstree buffer X-Git-Tag: v22.11~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42f500e75e7de5e0e9afa0de8ff2c727edd461cc;p=psmisc off by one malloc prob in pstree buffer --- diff --git a/ChangeLog b/ChangeLog index 24bead8..4c619ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Changes in 22.8 +=============== +2009-06-09 Craig Small + * Fixed pstree -a off-by-one error in buffer, Debian #536243 + Changes in 22.7 =============== 2009-05-04 Craig Small diff --git a/src/pstree.c b/src/pstree.c index 8b01712..5fa8bcc 100644 --- a/src/pstree.c +++ b/src/pstree.c @@ -749,6 +749,9 @@ read_proc (void) exit (1); } (void) close (fd); + /* If we have read the maximum screen length of args, bring it back by one to stop overflow */ + if (size >= buffer_size) + size--; if (size) buffer[size++] = 0; #ifdef WITH_SELINUX