library: add parameter checks for 'get', <MEMINFO> api
When this interface was normalized/standardized, under
the commit referenced below, the parameters were never
validated in the 'get' function. Let's plug that hole.
Reference(s):
commit 407f1b71de
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -951,6 +951,11 @@ PROCPS_EXPORT signed long procps_meminfo_get (
|
|||||||
time_t cur_secs;
|
time_t cur_secs;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (info == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
if (item < 0 || item >= PROCPS_MEMINFO_logical_end)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* we will NOT read the meminfo file with every call - rather, we'll offer
|
/* we will NOT read the meminfo file with every call - rather, we'll offer
|
||||||
a granularity of 1 second between reads ... */
|
a granularity of 1 second between reads ... */
|
||||||
cur_secs = time(NULL);
|
cur_secs = time(NULL);
|
||||||
|
Reference in New Issue
Block a user