policycoreutils: prevent null deref
PATCH 1/1 policycoreutils: prevent null deref
If the allocation of vallist fails, we jump to the error path where we immediately try to free vallist[i]. Make sure that doesn't happen.
I'd like to happily point out that this seems to address the last valid-seeming bug found by our internal code checker :)
thanks,
-serge
setsebool/setsebool.c renamed from setsebool/setsebool.c.orig +5 -3
@@ -252,9 +252,11 @@ int setbool(char **list, size_t start, sfprintf (stderr,"setsebool: out of memory" ); err: -for (i=0 ; i < boolcnt; i++) -free (vallist[i].name); -free (vallist); +if (vallist) { +for (i=0 ; i < boolcnt; i++) +free (vallist[i].name); +free (vallist); + }return -1 ; }
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.