libselinux: seusers: Check for strchr failure

If we have a malformed seusers entry we may not find the : proceeding
the level and would thus get a NULL.  This can blow up.  Check for this
error and bail gracefully.  Found by coverity

Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Dan Walsh 2012-06-21 09:42:45 -04:00 committed by Eric Paris
parent fa7a9a604e
commit bd8ea2eb6c

View File

@ -298,6 +298,7 @@ int getseuser(const char *username, const char *service,
seuser++;
level = strchr(seuser, ':');
if (! level) goto err;
*level = 0;
level++;
*r_seuser = strdup(seuser);