* [PATCH]fix the bug of using strtoul in priority_boost_parse() and freq_parse()
@ 2008-07-25 0:53 chuli
2008-07-25 1:14 ` Steve Grubb
0 siblings, 1 reply; 2+ messages in thread
From: chuli @ 2008-07-25 0:53 UTC (permalink / raw)
To: 'Steve Grubb'; +Cc: 'linux-audit'
[-- 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-25 1:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-25 0:53 [PATCH]fix the bug of using strtoul in priority_boost_parse() and freq_parse() chuli
2008-07-25 1:14 ` Steve Grubb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox