Check return value of getexeccon()
PATCH 1/1 Check return value of getexeccon()
getexeccon() , (and probably some other), may return NULL in it's return argument. Currently, this is causing the interpreter to abort due to a failed assertion. This patch adds a test in the argout typemap to fix this.
Index: selinuxswig.i
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/libselinux/src/selinuxswig.i,v retrieving revision 1.3
selinuxswig.i +8 -3
@@ -28,9 +28,14 @@ %typemap(in, numinputs=0) security_context_t *(security_context_t temp) { $1 = &temp; } -%typemap(argout) security_context_t * { - $result = t_output_helper($result, PyString_FromString(*$1)); -} +%typemap(argout) security_context_t * (char * temp) { + if (*$1) + temp = *$1; + else + temp = ""; + $result = t_output_helper($result, PyString_FromString(temp)); + +} extern int is_selinux_enabled(void); extern int is_selinux_mls_enabled(void);
Quoted 3 lines · Glauber de Oliveira Costa
getexeccon(), (and probably some other), may return NULL in it's return argument. Currently, this is causing the interpreter to abort due to a failed assertion. This patch adds a test in the argout typemap to fix this.
Thanks, merged as part of Dan's larger libselinux patch.
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.