]> granicus.if.org Git - psmisc/commitdiff
off by one malloc prob in pstree buffer
authorCraig Small <csmall@users.sourceforge.net>
Thu, 9 Jul 2009 03:27:41 +0000 (03:27 +0000)
committerCraig Small <csmall@users.sourceforge.net>
Thu, 9 Jul 2009 03:27:41 +0000 (03:27 +0000)
ChangeLog
src/pstree.c

index 24bead8d714ece72074fbcdc0429458a8a04808b..4c619eaaa233445cbdeef44af10a36f75c685f58 100644 (file)
--- 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
index 8b01712c93f55d0fad24079f659c37e7d8fcb5d5..5fa8bcc70f7fc204f077cade97aff1ebcc911f1e 100644 (file)
@@ -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