public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: audit-list <linux-audit@redhat.com>
Subject: [PATCH] the usage of strchr is wrong
Date: Tue, 05 Aug 2008 10:14:15 +0800	[thread overview]
Message-ID: <4897B777.5070900@cn.fujitsu.com> (raw)
In-Reply-To: <200808041537.31996.sgrubb@redhat.com>

Hello Steve,

Steve Grubb wrote:
> OK, I understand what you were trying to do with this patch. But I opted to 
> make a more complicated patch that separates the comparisons with the logic 
> of where it goes. SVN now has a commit that should fix the problem that you 
> found.  Thanks for reporting this problem!

Ok, but I tested this commit a moment ago. I think this is a bug about usage
of strchr().

strchr returns a pointer, this pointer should be given to 'p' directly.

Signed-off-by: Yu Zhiguo<yuzg@cn.fujitsu.com>
---
  src/auditctl.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/auditctl.c b/src/auditctl.c
index 1053638..868f770 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -209,7 +209,7 @@ static int audit_rule_setup(char *opt, int *filter, int *act)
  	if (++multiple != 1)
  		return 3;

-	*p = strchr(opt, ',');
+	p = strchr(opt, ',');
  	if (p == NULL || strchr(p+1, ','))
  		return 2;
  	*p = 0;

  reply	other threads:[~2008-08-05  2:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  6:54 [PATCH] make it match explicitly when use option '-a', '-A' and '-d' to specify "list,action" Yu Zhiguo
2008-07-18  8:49 ` Miloslav Trmač
2008-07-18 11:52   ` Yu Zhiguo
2008-07-18 11:56     ` Miloslav Trmač
2008-07-30  6:32     ` Yu Zhiguo
2008-07-31  0:57       ` Yu Zhiguo
2008-08-04 19:37         ` Steve Grubb
2008-08-05  2:14           ` Yu Zhiguo [this message]
2008-08-05  2:43             ` [PATCH] the usage of strchr is wrong Yu Zhiguo
2008-08-05 12:00             ` 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=4897B777.5070900@cn.fujitsu.com \
    --to=yuzg@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