Format specifier issue when building kernel

David Rebman drebman at nexuminc.com
Fri Nov 1 22:20:09 UTC 2013


unsubscribe

From: William Roberts <bill.c.roberts at gmail.com<mailto:bill.c.roberts at gmail.com>>
Date: Friday, November 1, 2013 at 5:10 PM
To: Richard Guy Briggs <rgb at redhat.com<mailto:rgb at redhat.com>>
Cc: "linux-audit at redhat.com<mailto:linux-audit at redhat.com>" <linux-audit at redhat.com<mailto:linux-audit at redhat.com>>
Subject: Re: Format specifier issue when building kernel


On Nov 1, 2013 12:58 PM, "Richard Guy Briggs" <rgb at redhat.com<mailto:rgb at redhat.com>> wrote:
>
> On Fri, Nov 01, 2013 at 12:38:15PM -0400, Richard Guy Briggs wrote:
> > On Fri, Nov 01, 2013 at 12:34:55PM -0400, Steve Grubb wrote:
> > > On Friday, November 01, 2013 12:24:55 PM Richard Guy Briggs wrote:
> > > > On Thu, Oct 31, 2013 at 12:25:55PM -0700, William Roberts wrote:
> > > > +char usermsg_format[64] = "";
> > >
> > > You might want this ^^^  to be static so its not global in scope.
> >
> > Yup, good point.  Thanks.
>
> Better yet, make it local to that if statement, but Eric Paris has a far
> more readable and elegant solution:
>
> diff --git a/kernel/audit.c b/kernel/audit.c
> @@ -864,8 +864,8 @@ static int audit_receive_msg(struct sk_buff *skb,
> struct nlmsghdr *nlh)
>                         }
>                         audit_log_common_recv_msg(&ab, msg_type);
>                         if (msg_type != AUDIT_USER_TTY)
> -                               audit_log_format(ab,
> -                                                " msg='%.AUDIT_MESSAGE_TEXT_MAXs'",
> +                               audit_log_format(ab, " msg='%.*s'",
> +                                                AUDIT_MESSAGE_TEXT_MAX,
>                                                  (char *)data);
>                         else {
>                                 int size;
>
> I forgot about the * format specifier...
Yeah me too... I think everyone does :-)
>
> > > -Steve
> > >
> > > > - RGB
> >
> > - RGB
>
> - RGB
>
> --
> Richard Guy Briggs <rbriggs at redhat.com<mailto:rbriggs at redhat.com>>
> Senior Software Engineer
> Kernel Security
> AMER ENG Base Operating Systems
> Remote, Ottawa, Canada
> Voice: +1.647.777.2635
> Internal: (81) 32635
> Alt: +1.613.693.0684x3545
>
> --
> Linux-audit mailing list
> Linux-audit at redhat.com<mailto:Linux-audit at redhat.com>
> https://www.redhat.com/mailman/listinfo/linux-audit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-audit/attachments/20131101/4f2b1cdf/attachment.htm>


More information about the Linux-audit mailing list