All of lore.kernel.org
 help / color / mirror / Atom feed
From: wangf <wangf@cn.fujitsu.com>
To: sgrubb@redhat.com, linux-audit@redhat.com
Subject: There is a bug on parsing file path in auditd-config.c and audispd-pconfig.c
Date: Tue, 01 Jul 2008 14:43:45 +0800	[thread overview]
Message-ID: <4869D221.1030904@cn.fujitsu.com> (raw)

Hi Steve,

There is a bug in function dispatch_parser() and path_parser().

when we use dir = dirname (tdir), if tdir is not NULL, tdir and dir 
point to the same addr., so if we use free(tdir) before 
audit_msg(LOG_ERR, "The directory name: %s is too short - line %d", dir, 
line); we can not get the dir's correct value.

This patch can solve this problem.

Signed-off-by: Wang Fang <wangf@cn.fujitsu.com>
---
diff -Nrup audit-1.7.4/audisp/audispd-pconfig.c audit-1.7.4-new/audisp/audispd-pconfig.c
--- audit-1.7.4/audisp/audispd-pconfig.c	2007-09-02 23:24:15.000000000 +0800
+++ audit-1.7.4-new/audisp/audispd-pconfig.c	2008-06-21 18:33:14.000000000 +0800
@@ -379,10 +379,10 @@ static int path_parser(struct nv_pair *n
 	if (tdir)
 		dir = dirname(tdir);
 	if (dir == NULL || strlen(dir) < 4) { //  '/var' is shortest dirname
-		free(tdir);
 		audit_msg(LOG_ERR,
 			"The directory name: %s is too short - line %d",
 			dir, line);
+		free(tdir);
 		return 1;
 	}
 
diff -Nrup audit-1.7.4/src/auditd-config.c audit-1.7.4-new/src/auditd-config.c
--- audit-1.7.4/src/auditd-config.c	2008-05-09 22:44:38.000000000 +0800
+++ audit-1.7.4-new/src/auditd-config.c	2008-06-21 18:39:58.000000000 +0800
@@ -592,10 +592,10 @@ static int dispatch_parser(struct nv_pai
 	if (tdir)
 		dir = dirname(tdir);
 	if (dir == NULL || strlen(dir) < 4) { //  '/var' is shortest dirname
-		free(tdir);
 		audit_msg(LOG_ERR,
 			"The directory name: %s is too short - line %d",
 			dir, line);
+		free(tdir);
 		return 1;
 	}
 
--
Best Regards,
Wang Fang

             reply	other threads:[~2008-07-01  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01  6:43 wangf [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-24  4:12 There is a bug on parsing file path in auditd-config.c and audispd-pconfig.c wangf
2008-07-24 20:52 ` 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=4869D221.1030904@cn.fujitsu.com \
    --to=wangf@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 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.