From: Ivan Gyurdiev <ivg2@cornell.edu>
To: selinux@tycho.nsa.gov
Cc: Stephen Smalley <sds@tycho.nsa.gov>
Subject: [ SEMANAGE 3 ] Fix evil strtol bug (breaks booleans)
Date: Fri, 04 Nov 2005 00:20:47 -0500 [thread overview]
Message-ID: <436AEFAF.9070400@cornell.edu> (raw)
[-- 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;
}
reply other threads:[~2005-11-04 5:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=436AEFAF.9070400@cornell.edu \
--to=ivg2@cornell.edu \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.