diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2012-07-11 16:10:13 -0400 |
---|---|---|
committer | Stephen Smalley <sds@tycho.nsa.gov> | 2012-07-11 16:10:13 -0400 |
commit | c9726aba339f3d935ff14c0734edf13116af3cbf (patch) | |
tree | 9aaaf71ebc9929acd670b998748a74d593d1e796 | |
parent | ba70ee4c5ab8026e97fce5c2452dfe588dfaac3e (diff) | |
download | libselinux-c9726aba339f3d935ff14c0734edf13116af3cbf.tar.gz |
Fix handling of app id 0.
-rw-r--r-- | src/android.c | 8 |
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); |