summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordcashman <dcashman@google.com>2016-02-29 22:08:20 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-02-29 22:08:20 +0000
commitde4ff16d9539400cc63059b6cc23851ec6dab578 (patch)
treeecb380e43037933a68413362fc19f5460c16a900
parent4b8c57b5d932758260a571937e9158f76eb37614 (diff)
parentcdc89940cc87d795157b4090a7b9ef5ada14e829 (diff)
downloadlibselinux-de4ff16d9539400cc63059b6cc23851ec6dab578.tar.gz
BACKPORT: libselinux: procattr: return einval for <= 0 pid args.
am: cdc89940cc * commit 'cdc89940cc87d795157b4090a7b9ef5ada14e829': BACKPORT: libselinux: procattr: return einval for <= 0 pid args.
-rw-r--r--src/procattr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/procattr.c b/src/procattr.c
index a55465a..74c0012 100644
--- a/src/procattr.c
+++ b/src/procattr.c
@@ -139,7 +139,12 @@ static int setprocattrcon(const char * context,
#define getpidattr_def(fn, attr) \
int get##fn(pid_t pid, char **c) \
{ \
- return getprocattrcon(c, pid, #attr); \
+ if (pid <= 0) { \
+ errno = EINVAL; \
+ return -1; \
+ } else { \
+ return getprocattrcon(c, pid, #attr); \
+ } \
}
all_selfattr_def(con, current)