library: more miscellaneous pids implementation tweaks
A patch containing the following miscellaneous tweaks: . make a supposedly robust parameter test truly robust [ ensure the largest enum value used with validation ] . remove duplicate item test in cleanup_stack function [ is already subordinate to test of PROCPS_PIDS_noop ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
a61f78d6e0
commit
1b38b751ff
@ -739,8 +739,7 @@ static inline void cleanup_stack (
|
||||
if (p->item < PROCPS_PIDS_noop) {
|
||||
if (Item_table[p->item].freefunc)
|
||||
Item_table[p->item].freefunc(p);
|
||||
if (p->item < PROCPS_PIDS_noop)
|
||||
p->result.ull_int = 0;
|
||||
p->result.ull_int = 0;
|
||||
}
|
||||
++p;
|
||||
}
|
||||
@ -802,7 +801,7 @@ static inline int items_check_failed (
|
||||
* ^~~~~~~~~~~~~~~~
|
||||
*/
|
||||
if (maxitems < 1
|
||||
|| (void *)items < (void *)PROCPS_PIDS_physical_end)
|
||||
|| (void *)items < (void *)0x8000) // twice as big as our largest enum
|
||||
return -1;
|
||||
for (i = 0; i < maxitems; i++) {
|
||||
// a pids_item is currently unsigned, but we'll protect our future
|
||||
|
Loading…
Reference in New Issue
Block a user