From: Jim Warner Date: Mon, 28 Sep 2015 05:00:00 +0000 (-0500) Subject: library: strengthen sort order parameter checks X-Git-Tag: v4.0.0~1014 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27283bbc6f405522a0caf744ec5c6b6204cd975a;p=procps-ng library: strengthen sort order parameter checks The way that the passed sort order was validated would allow the invalid 0 to fall between the sofa cushions. So this patch will simply close that former oversight. Signed-off-by: Jim Warner --- diff --git a/proc/pids.c b/proc/pids.c index 6be88d81..a3229a15 100644 --- a/proc/pids.c +++ b/proc/pids.c @@ -1389,7 +1389,7 @@ PROCPS_EXPORT struct pids_stack **procps_pids_stacks_sort ( // a pids_item is currently unsigned, but we'll protect our future if (sort < 0 || sort > PROCPS_PIDS_noop) return NULL; - if (order < -1 || order > +1) + if (order != PROCPS_SORT_ASCEND && order != PROCPS_SORT_DESCEND) return NULL; if (numstacked < 2) return stacks;