Blame SOURCES/procps-ng-3.3.15-ps-out-of-bonds-read.patch

ef29c0
diff --git a/ps/display.c b/ps/display.c
ef29c0
index 1927fd6..e7ab351 100644
ef29c0
--- a/ps/display.c
ef29c0
+++ b/ps/display.c
ef29c0
@@ -357,7 +357,7 @@ static void simple_spew(void){
ef29c0
   if (selection_list && selection_list->typecode == SEL_PID_QUICK) {
ef29c0
     flags |= PROC_PID;
ef29c0
 
ef29c0
-    pidlist = (pid_t*) malloc(selection_list->n * sizeof(pid_t));
ef29c0
+    pidlist = (pid_t*) malloc((selection_list->n + 1) * sizeof(pid_t));
ef29c0
     if (!pidlist) {
ef29c0
       fprintf(stderr, _("error: not enough memory\n"));
ef29c0
       exit(1);
ef29c0
@@ -366,6 +366,9 @@ static void simple_spew(void){
ef29c0
     for (i = 0; i < selection_list->n; i++) {
ef29c0
       pidlist[i] = selection_list->u[selection_list->n-i-1].pid;
ef29c0
     }
ef29c0
+
ef29c0
+    // delimit the array with nul object (0); RHBZ#2153813
ef29c0
+    pidlist[selection_list->n] = (pid_t)0;
ef29c0
   }
ef29c0
 
ef29c0
   ptp = openproc(flags, pidlist);