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