fix use-after-free in matchpathcon.c
PATCH 1/1 fix use-after-free in matchpathcon.c
Hi,
Following is a set of patches against (potential) bugs found by Coverity in libselinux. Hopefully the rest of the selinux-usr libraries will follow. None of the selinux-usr ones looked groundbreaking, whereas a quick peek at some later libraries looked scarier.
All of these bugs seem to be on error paths, and the most inane are resource leaks on error paths, but some look like they should definately cause segvs.
This patch fixes a bug found in matchpathcon.c by Coverity:
process_line() uses anchored_regex after freeing it if regcomp() fails.
thanks,
-serge
matchpathcon.c +2 -1
@@ -465,11 +465,12 @@ static int process_line( const char *patregcomp (&spec_arr[nspec].regex, anchored_regex,REG_EXTENDED |REG_NOSUB ); -free (anchored_regex);if (regerr <0 ) {myprintf ("%s: line %d has invalid regex %s\n" , path, lineno, anchored_regex); +free (anchored_regex);return 0 ; } +free (anchored_regex);/* Convert the type string to a mode format */ spec_arr[nspec].type_str = type;
--
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.
Quoted 5 lines · On Wed, 2005-08-10 at 16:32 -0500, [email protected] wrote:
Following is a set of patches against (potential) bugs found by Coverity in libselinux. Hopefully the rest of the selinux-usr libraries will follow. None of the selinux-usr ones looked groundbreaking, whereas a quick peek at some later libraries looked scarier.
Thanks, all merged as of libselinux 1.25.2.
Signature · 8 lines
Stephen Smalley National Security Agency -- 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.