From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Zhiguo Subject: [PATCH] the usage of strchr is wrong Date: Tue, 05 Aug 2008 10:14:15 +0800 Message-ID: <4897B777.5070900@cn.fujitsu.com> References: <48803E3C.4060209@cn.fujitsu.com> <48900AF3.1050204@cn.fujitsu.com> <48910DF3.70809@cn.fujitsu.com> <200808041537.31996.sgrubb@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200808041537.31996.sgrubb@redhat.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, 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 --- 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;