From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Zhiguo Subject: Re: [PATCH] the usage of strchr is wrong Date: Tue, 05 Aug 2008 10:43:25 +0800 Message-ID: <4897BE4D.4060506@cn.fujitsu.com> References: <48803E3C.4060209@cn.fujitsu.com> <48900AF3.1050204@cn.fujitsu.com> <48910DF3.70809@cn.fujitsu.com> <200808041537.31996.sgrubb@redhat.com> <4897B777.5070900@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4897B777.5070900@cn.fujitsu.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: Steve Grubb Cc: audit-list List-Id: linux-audit@redhat.com Hello Steve, Yu Zhiguo wrote: > Ok, but I tested this commit a moment ago. I think this is a bug about > usage > of strchr(). We'd better correct this bug ASAP. Otherwise no rule can be added/deleted and the error message reported is very strange, e.g. # ./auditctl -a entry,always Append rule - bad keyword Wntry,always # ./auditctl -d never,exit Delete rule - bad keyword Yever,exit > > strchr returns a pointer, this pointer should be given to 'p' directly. > > Signed-off-by: Yu Zhiguo > --- > 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;