Linux-audit Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Guy Briggs <rgb@redhat.com>
To: linux-audit@redhat.com
Subject: Re: Format specifier issue when building kernel
Date: Fri, 1 Nov 2013 15:57:11 -0400	[thread overview]
Message-ID: <20131101195711.GA3405@madcap2.tricolour.ca> (raw)
In-Reply-To: <20131101163815.GC24236@madcap2.tricolour.ca>

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

> > -Steve
> > 
> > > - RGB
> 
> - RGB

- RGB

--
Richard Guy Briggs <rbriggs@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

  reply	other threads:[~2013-11-01 19:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 23:30 Format specifier issue when building kernel William Roberts
2013-10-28 23:31 ` William Roberts
2013-10-29  1:35   ` Richard Guy Briggs
2013-10-29  1:43     ` William Roberts
2013-10-29  3:55       ` William Roberts
2013-10-31 18:45         ` Richard Guy Briggs
2013-10-31 19:25           ` William Roberts
2013-11-01 16:24             ` Richard Guy Briggs
2013-11-01 16:34               ` Steve Grubb
2013-11-01 16:38                 ` Richard Guy Briggs
2013-11-01 19:57                   ` Richard Guy Briggs [this message]
2013-11-01 22:10                     ` William Roberts
2013-11-01 22:20                       ` David Rebman
2013-11-01 22:22                         ` William Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131101195711.GA3405@madcap2.tricolour.ca \
    --to=rgb@redhat.com \
    --cc=linux-audit@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox