Skip to contentSkip to conversation

fix setfiles segfault caused by libselinux-1.22

PATCH Andreas Steinmetz 2 participants 2 messages Apr 4, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

setfiles does reset user defined functions by calling the related setup function with NULL as argument. Instead of resetting to the default these setup functions did set up NULL as the function pointer. Fix attached.

Signature · 1 line
Andreas Steinmetz                       SPAMmers use [email protected]
src/matchpathcon.c +8 -2
@@ -29,7 +29,10 @@
 
 void set_matchpathcon_printf(void (*f)(const char *fmt, ...))
 {
-	myprintf = f;
+	if (f)
+		myprintf = f;
+	else
+		myprintf = &default_printf;
 }
 
 static int default_invalidcon(const char *path, unsigned lineno, char *context)
@@ -45,7 +48,10 @@
 
 void set_matchpathcon_invalidcon(int (*f)(const char *p, unsigned l, char *c))
 {
-	myinvalidcon = f;
+	if (f)
+		myinvalidcon = f;
+	else
+		myinvalidcon = &default_invalidcon;
 }
 
 /*
#1 lore raw
Quoted 3 lines · Andreas Steinmetz

setfiles does reset user defined functions by calling the related setup function with NULL as argument. Instead of resetting to the default these setup functions did set up NULL as the function pointer. Fix attached.

Thanks, merged as of libselinux 1.23.4.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.