summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2012-07-11 16:10:13 -0400
committerStephen Smalley <sds@tycho.nsa.gov>2012-07-11 16:10:13 -0400
commitc9726aba339f3d935ff14c0734edf13116af3cbf (patch)
tree9aaaf71ebc9929acd670b998748a74d593d1e796
parentba70ee4c5ab8026e97fce5c2452dfe588dfaac3e (diff)
downloadlibselinux-c9726aba339f3d935ff14c0734edf13116af3cbf.tar.gz
Fix handling of app id 0.
-rw-r--r--src/android.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/android.c b/src/android.c
index 2bebaf1..90ade4d 100644
--- a/src/android.c
+++ b/src/android.c
@@ -294,7 +294,7 @@ int selinux_android_setfilecon(const char *pkgdir,
if (end[0] != '_')
goto err;
id = strtoul(end + 2, NULL, 10);
- if (!id || id >= MLS_CATS/2)
+ if (id >= MLS_CATS/2)
goto err;
if (end[1] == 'i')
id += MLS_CATS/2;
@@ -334,7 +334,7 @@ int selinux_android_setfilecon(const char *pkgdir,
if (context_type_set(ctx, cur->type))
goto oom;
- if (cur->levelFromUid && id) {
+ if (cur->levelFromUid) {
char level[255];
snprintf(level, sizeof level, "%s:c%lu",
context_range_get(ctx), id);
@@ -420,7 +420,7 @@ int selinux_android_setcontext(uid_t uid,
if (end[0] != '_')
goto err;
id = strtoul(end + 2, NULL, 10);
- if (!id || id >= MLS_CATS/2)
+ if (id >= MLS_CATS/2)
goto err;
if (end[1] == 'i')
id += MLS_CATS/2;
@@ -458,7 +458,7 @@ int selinux_android_setcontext(uid_t uid,
if (context_type_set(ctx, cur->domain))
goto oom;
- if (cur->levelFromUid && id) {
+ if (cur->levelFromUid) {
char level[255];
snprintf(level, sizeof level, "%s:c%lu",
context_range_get(ctx), id);