* [ SEMANAGE 3 ] Fix evil strtol bug (breaks booleans)
@ 2005-11-04 5:20 Ivan Gyurdiev
0 siblings, 0 replies; only message in thread
From: Ivan Gyurdiev @ 2005-11-04 5:20 UTC (permalink / raw)
To: selinux; +Cc: Stephen Smalley
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
I mentioned earlier that strtol wasn't behaving according to manpage.
That's actually not true - it works fine, and that was just covering up
a much worse bug. The bug caused fetch_int() to always return 0, and as
a result to reset all booleans to 0. It wasn't noticed, because my test
boolean was explicitly set to 1, and I wasn't paying attention to the
other one that I have in booleans.local.
Changes:
- fix the bug (pass right value into strtol)
- remove errno printing - the errno doesn't make any sense most of the time
[-- Attachment #2: libsemanage.fix_strtol_bug.diff --]
[-- Type: text/x-patch, Size: 712 bytes --]
diff -Naurp --exclude CVS --exclude ChangeLog --exclude VERSION --exclude Makefile old/libsemanage/src/parse_utils.c new/libsemanage/src/parse_utils.c
--- old/libsemanage/src/parse_utils.c 2005-11-03 12:48:03.000000000 -0500
+++ new/libsemanage/src/parse_utils.c 2005-11-04 00:06:18.000000000 -0500
@@ -256,10 +256,10 @@ int parse_fetch_int(
goto err;
}
- value = strtol(info->ptr, &test, 10);
+ value = strtol(str, &test, 10);
if (*test != '\0') {
- ERR(handle, "could not parse numeric value: %s (%s: %u)\n%s",
- strerror(errno), info->filename,
+ ERR(handle, "could not parse numeric value \"%s\": "
+ "(%s: %u)\n%s", str, info->filename,
info->lineno, info->orig_line);
goto err;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-11-04 5:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-04 5:20 [ SEMANAGE 3 ] Fix evil strtol bug (breaks booleans) Ivan Gyurdiev
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.