[PATCH] the usage of strchr is wrong

Yu Zhiguo yuzg at cn.fujitsu.com
Tue Aug 5 02:14:15 UTC 2008


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 at 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;




More information about the Linux-audit mailing list