public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: "chuli" <chul@cn.fujitsu.com>
To: 'Steve Grubb' <sgrubb@redhat.com>
Cc: 'linux-audit' <linux-audit@redhat.com>
Subject: [PATCH]fix the bug of using strtoul in priority_boost_parse() and freq_parse()
Date: Fri, 25 Jul 2008 08:53:48 +0800	[thread overview]
Message-ID: <000901c8edf0$e5ec4620$958da70a@truly> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

Hello Mr. Steve£¬

  In src/auditd-config.c and audisp/audispd-config.c, the function
priority_boost_parser() and freq_parse() use strtoul to convert the numeric 
and
then compare it with INT_MAX. It meant that the value of priority_boost and 
freq
in /etc/audit/auditd.conf should not be larger than INT_MAX.

  But there is a little error in the codes: it uses an int variable to store 
the
result of strtoul() and then compare the variable with INT_MAX. So the result
of comparison is always "not larger than".
  I think it's better to modify the codes to implement its intention.

  The attached patch fixes the problem in src/auditd-config.c and
audisp/audispd-config.c of audit-1.7.4.

  What's your opinion about such modification?

PS:
priority_boost: a non-negative number that tells the audit daemon how much of
a priority boost it should take.
freq: a non-negative number that tells the audit damon how many records to 
write
before issuing an explicit flush to disk command.


Signed-off-by: Chu Li<chul@cn.fujitsu.com>
---
diff --git a/src/auditd-config.c b/src/auditd-config.c
index 8a81b46..e9111a4 100644
--- a/src/auditd-config.c
+++ b/src/auditd-config.c
@@ -782,7 +782,7 @@ static int freq_parser(struct nv_pair *nv, int line,
 		struct daemon_conf *config)
 {
 	const char *ptr = nv->value;
-	int i;
+	unsigned long i;

 	audit_msg(LOG_DEBUG, "freq_parser called with: %s", nv->value);

@@ -1112,7 +1112,7 @@ static int priority_boost_parser(struct nv_pair *nv, int 
line,
 	struct daemon_conf *config)
 {
 	const char *ptr = nv->value;
-	int i;
+	unsigned long i;

 	audit_msg(LOG_DEBUG, "priority_boost_parser called with: %s",
 								nv->value);
diff --git a/audisp/audispd-config.c b/audisp/audispd-config.c
index b0bcaef..e9d254a 100644
--- a/audisp/audispd-config.c
+++ b/audisp/audispd-config.c
@@ -387,7 +387,7 @@ static int priority_boost_parser(struct nv_pair *nv, int 
line,
 	struct daemon_conf *config)
 {
 	const char *ptr = nv->value;
-	int i;
+	unsigned long i;

 	audit_msg(LOG_DEBUG, "priority_boost_parser called with: %s",
        				nv->value);

Regards
Chu Li

             reply	other threads:[~2008-07-25  0:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25  0:53 chuli [this message]
2008-07-25  1:14 ` [PATCH]fix the bug of using strtoul in priority_boost_parse() and freq_parse() Steve Grubb

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='000901c8edf0$e5ec4620$958da70a@truly' \
    --to=chul@cn.fujitsu.com \
    --cc=linux-audit@redhat.com \
    --cc=sgrubb@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox