* [SEMANAGE] Fix parse_optional_ch
@ 2006-02-10 21:39 Ivan Gyurdiev
2006-02-13 15:33 ` Stephen Smalley
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Gyurdiev @ 2006-02-10 21:39 UTC (permalink / raw)
To: SELinux List; +Cc: Stephen Smalley, Joshua Brindle
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
> Method ivg2: it appears that an seuser with no mls field causes a
segfault
> ivg2 how so?
> ivg2 trace?
> ivg2 should not happen
> Method #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.
[-- Attachment #2: libsemanage.parse_optional_fix.diff --]
[-- Type: text/x-patch, Size: 939 bytes --]
diff -Naurp --exclude-from excludes old/libsemanage/src/parse_utils.c new/libsemanage/src/parse_utils.c
--- old/libsemanage/src/parse_utils.c 2006-01-05 12:49:15.000000000 -0500
+++ new/libsemanage/src/parse_utils.c 2006-02-10 16:33:29.000000000 -0500
@@ -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(
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [SEMANAGE] Fix parse_optional_ch
2006-02-10 21:39 [SEMANAGE] Fix parse_optional_ch Ivan Gyurdiev
@ 2006-02-13 15:33 ` Stephen Smalley
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2006-02-13 15:33 UTC (permalink / raw)
To: Ivan Gyurdiev; +Cc: SELinux List, Joshua Brindle
On Fri, 2006-02-10 at 16:39 -0500, Ivan Gyurdiev wrote:
> 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.
Merged as of libsemanage 1.5.22.
--
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-13 15:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-10 21:39 [SEMANAGE] Fix parse_optional_ch Ivan Gyurdiev
2006-02-13 15:33 ` Stephen Smalley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.