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 problem of using strtoul in priority_boost_parse and flush_parse
Date: Tue, 24 Jun 2008 14:05:57 +0800	[thread overview]
Message-ID: <002501c8d5c0$5e6343e0$548da70a@truly> (raw)

[-- 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 --]



                 reply	other threads:[~2008-06-24  6:05 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='002501c8d5c0$5e6343e0$548da70a@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