* [PATCH]fix the problem of using strtoul in priority_boost_parse and flush_parse
@ 2008-06-24 6:05 chuli
0 siblings, 0 replies; only message in thread
From: chuli @ 2008-06-24 6:05 UTC (permalink / raw)
To: 'Steve Grubb'; +Cc: 'linux-audit'
[-- Attachment #1: Type: text/plain, Size: 374 bytes --]
Hello,
When the configure value of priority_boost or flush is larger than INT_MAX,
auditd is still started successfully. The priority_boost_parser and flush_parse
code use an int variable to store the result strtoul() and then compared with
INT_MAX.
The attached patch fixes the problem in src/auditd-config.c and
audisp/audispd-config.c.
Regards
Chu Li
[-- Attachment #2: audit-1.7.4-audisp_INT_MAX.patch --]
[-- Type: application/octet-stream, Size: 920 bytes --]
--- audit/audisp/audispd-config.c 2008-06-24 13:37:33.000000000 +0800
+++ audit-1.7.4/audisp/audispd-config.c 2008-06-24 13:38:45.000000000 +0800
@@ -388,6 +388,7 @@
{
const char *ptr = nv->value;
int i;
+ unsigned long j;
audit_msg(LOG_DEBUG, "priority_boost_parser called with: %s",
nv->value);
@@ -403,7 +404,7 @@
}
/* convert to unsigned int */
errno = 0;
- i = strtoul(nv->value, NULL, 10);
+ j = strtoul(nv->value, NULL, 10);
if (errno) {
audit_msg(LOG_ERR,
"Error converting string to a number (%s) - line %d",
@@ -411,13 +412,13 @@
return 1;
}
/* Check its range */
- if (i > INT_MAX) {
+ if (j > INT_MAX) {
audit_msg(LOG_ERR,
"Error - converted number (%s) is too large - line %d",
nv->value, line);
return 1;
}
- config->priority_boost = (unsigned int)i;
+ config->priority_boost = (unsigned int)j;
return 0;
}
[-- Attachment #3: audit-1.7.4-INT_MAX.patch --]
[-- Type: application/octet-stream, Size: 1647 bytes --]
--- audit/src/auditd-config.c 2008-05-09 22:44:38.000000000 +0800
+++ audit-1.7.4/src/auditd-config.c 2008-06-24 13:31:56.000000000 +0800
@@ -783,6 +783,7 @@
{
const char *ptr = nv->value;
int i;
+ unsigned long j;
audit_msg(LOG_DEBUG, "freq_parser called with: %s", nv->value);
@@ -798,7 +799,7 @@
/* convert to unsigned int */
errno = 0;
- i = strtoul(nv->value, NULL, 10);
+ j = strtoul(nv->value, NULL, 10);
if (errno) {
audit_msg(LOG_ERR,
"Error converting string to a number (%s) - line %d",
@@ -806,13 +807,13 @@
return 1;
}
/* Check its range */
- if (i > INT_MAX) {
+ if (j > INT_MAX) {
audit_msg(LOG_ERR,
"Error - converted number (%s) is too large - line %d",
nv->value, line);
return 1;
}
- config->freq = (unsigned int)i;
+ config->freq = (unsigned int)j;
return 0;
}
@@ -1113,6 +1114,7 @@
{
const char *ptr = nv->value;
int i;
+ unsigned long j;
audit_msg(LOG_DEBUG, "priority_boost_parser called with: %s",
nv->value);
@@ -1129,7 +1131,7 @@
/* convert to unsigned int */
errno = 0;
- i = strtoul(nv->value, NULL, 10);
+ j = strtoul(nv->value, NULL, 10);
if (errno) {
audit_msg(LOG_ERR,
"Error converting string to a number (%s) - line %d",
@@ -1137,13 +1139,13 @@
return 1;
}
/* Check its range */
- if (i > INT_MAX) {
+ if (j > INT_MAX) {
audit_msg(LOG_ERR,
"Error - converted number (%s) is too large - line %d",
nv->value, line);
return 1;
}
- config->priority_boost = (unsigned int)i;
+ config->priority_boost = (unsigned int)j;
return 0;
}
[-- Attachment #4: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-06-24 6:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 6:05 [PATCH]fix the problem of using strtoul in priority_boost_parse and flush_parse chuli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox