From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rebman Subject: Re: Format specifier issue when building kernel Date: Fri, 1 Nov 2013 22:20:09 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0771246318185386414==" Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: William Roberts , Richard Guy Briggs Cc: "linux-audit@redhat.com" List-Id: linux-audit@redhat.com --===============0771246318185386414== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CE9993344ECBEdrebmannexuminccom_" --_000_CE9993344ECBEdrebmannexuminccom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable unsubscribe From: William Roberts > Date: Friday, November 1, 2013 at 5:10 PM To: Richard Guy Briggs > Cc: "linux-audit@redhat.com" > Subject: Re: Format specifier issue when building kernel On Nov 1, 2013 12:58 PM, "Richard Guy Briggs" > 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] =3D ""; > > > > > > 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 !=3D AUDIT_USER_TTY) > - audit_log_format(ab, > - " msg=3D'%.AUDIT_MESSAGE= _TEXT_MAXs'", > + audit_log_format(ab, " msg=3D'%.*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 > > 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@redhat.com > https://www.redhat.com/mailman/listinfo/linux-audit --_000_CE9993344ECBEdrebmannexuminccom_ Content-Type: text/html; charset="us-ascii" Content-ID: <1AEE89F23686DA4282F14616B8CC64FB@nexuminc.com> Content-Transfer-Encoding: quoted-printable
unsubscribe

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


On Nov 1, 2013 12:58 PM, "Richard Guy Briggs" <rgb@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 Rober= ts wrote:
> > > > +char usermsg_format[64] =3D "";
> > >
> > > 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 f= ar
> 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 *s= kb,
> struct nlmsghdr *nlh)
>                     =     }
>                     =     audit_log_common_recv_msg(&ab, msg_type);
>                     =     if (msg_type !=3D AUDIT_USER_TTY)
> -                    = ;           audit_log_format(ab,
> -                    = ;                     &nb= sp;      " msg=3D'%.AUDIT_MESSAGE_TEXT_MAXs'",
> +                   &= nbsp;           audit_log_format(ab, " msg=3D= '%.*s'",
> +                   &= nbsp;                    =        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@r= edhat.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@redhat.com > https:= //www.redhat.com/mailman/listinfo/linux-audit

--_000_CE9993344ECBEdrebmannexuminccom_-- --===============0771246318185386414== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============0771246318185386414==--