[PATCH] the usage of strchr is wrong

Yu Zhiguo yuzg at cn.fujitsu.com
Tue Aug 5 02:43:25 UTC 2008


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