All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>, audit-list <linux-audit@redhat.com>
Subject: the format string of printf to print audit status is wrong
Date: Thu, 31 Jul 2008 13:07:48 +0800	[thread overview]
Message-ID: <489148A4.3050807@cn.fujitsu.com> (raw)

Hello Steve,

  all audit status's type is __u32, so '%u' should be used
in format string of printf rather than '%d', otherwise the
value outputted to user will be wraparound.

  For example:
  # auditctl -r 4294967295
  AUDIT_STATUS: enabled=1 flag=1 pid=8999 rate_limit=-1 backlog_limit=320 
lost=2241 backlog=0

but it should be
  # auditctl -r 4294967295
  AUDIT_STATUS: enabled=1 flag=1 pid=8999 rate_limit=4294967295 
backlog_limit=320 lost=2270 backlog=0


  This is the patch. Can you apply it?

Signed-off-by: Yu Zhiguo<yuzg@cn.fujitsu.com>
---
  src/auditctl.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/auditctl.c b/src/auditctl.c
index d740509..5416e9b 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -1349,8 +1349,8 @@ static int audit_print_reply(struct audit_reply *rep)
  			printed = 1;
  			return 0;
  		case AUDIT_GET:
-			printf("AUDIT_STATUS: enabled=%d flag=%d pid=%d"
-			" rate_limit=%d backlog_limit=%d lost=%d backlog=%d\n",
+			printf("AUDIT_STATUS: enabled=%u flag=%u pid=%u"
+			" rate_limit=%u backlog_limit=%u lost=%u backlog=%u\n",
  			rep->status->enabled, rep->status->failure,
  			rep->status->pid, rep->status->rate_limit,
  			rep->status->backlog_limit, rep->status->lost,

             reply	other threads:[~2008-07-31  5:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-31  5:07 Yu Zhiguo [this message]
2008-07-31 13:07 ` the format string of printf to print audit status is wrong Eric Paris
2008-08-01  9:21   ` Yu Zhiguo
2008-08-04 20:11   ` Steve Grubb
2008-08-04 20:06 ` Steve Grubb

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=489148A4.3050807@cn.fujitsu.com \
    --to=yuzg@cn.fujitsu.com \
    --cc=linux-audit@redhat.com \
    --cc=sgrubb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.