Fix parse_optional_ch
Quoted 11 lines
Method ivg2: it appears that an seuser with no mls field causes a segfault ivg2 how so?
ivg2 trace?
ivg2 should not happenMethod #0 0x00379ad9 in parse_skip_space (handle=0x99336c0, info=0xa0526b0) at parse_utils.c:96 Method #1 0x00380abd in seuser_parse (handle=0x99336c0, info=0xa0526b0, seuser=0xa052638) at seusers_file.c:84 Method #2 0x00371d22 in dbase_file_cache (handle=0x99336c0, dbase=0x9938198) at database_file.c:101 Method #3 0x0037aa6e in semanage_base_merge_components (handle=0x99336c0) at policy_components.c:164 Method #4 0x00375df9 in semanage_direct_commit (sh=0x99336c0) at direct_api.c:512 Method #5 0x00378424 in semanage_commit (sh=0x99336c0) at handle.c:227 Method #6 0x08049b13 in main (argc=6, argv=0xbff199d4) at semodule.c:361
Joshua please try to reproduce with the following patch applied. Changelog:
- handle NULL as no match in parse_optional_ch
- do not advance a NULL pointer in parse_optional_ch - that breaks NULL check later
- remove NULL check in parse_optional_str - doesn't seem necessary.
libsemanage/src/parse_utils.c +11 -10
@@ -217,23 +217,24 @@ int parse_assert_str( }int parse_optional_ch (parse_info_t * info,const char ch) { -if (info->ptr && (*(info->ptr) != ch)) + +if (!info->ptr)return STATUS_NODATA ; -else { - info->ptr++; -return STATUS_SUCCESS ; - } +if (*(info->ptr) != ch) +return STATUS_NODATA ; + + info->ptr++; +return STATUS_SUCCESS ; }int parse_optional_str (parse_info_t * info,const char * str) {size_t len =strlen (str); -if (info->ptr &&strncmp (info->ptr, str, len)) +if (strncmp (info->ptr, str, len))return STATUS_NODATA ; -else { - info->ptr += len; -return STATUS_SUCCESS ; - } + + info->ptr += len; +return STATUS_SUCCESS ; } int parse_fetch_int(
Quoted 6 lines · Ivan Gyurdiev
Joshua please try to reproduce with the following patch applied. Changelog:
- handle NULL as no match inparse_optional_ch
- do not advance a NULL pointer inparse_optional_ch- that breaks NULL check later
- remove NULL check inparse_optional_str- doesn't seem necessary.
Merged as of libsemanage 1.5.22.
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.