Linux-audit Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Weird timestamp length constraint in auparse.c
@ 2015-12-10  2:10 Santosh Ananthakrishnan
  2015-12-14 21:02 ` Steve Grubb
  0 siblings, 1 reply; 3+ messages in thread
From: Santosh Ananthakrishnan @ 2015-12-10  2:10 UTC (permalink / raw)
  To: linux-audit


[-- Attachment #1.1: Type: text/plain, Size: 882 bytes --]

Hi list

auparse breaks if supplied events with timestamps that are less than 10
characters long, including the milliseconds field. This should never happen
in production, but it can make for fairly mysterious output during testing
if you're generating your own timestamp and eventid numbers :-)

I think the issue is in the str2event function:

static int str2event(char *s, au_event_t *e)
{
        char *ptr;
        errno = 0;
        ptr = strchr(s*+10*, ':');
        if (ptr) {
                e->serial = strtoul(ptr+1, NULL, 10);

This function seems to be searching for the colon that splits the timestamp
from the eventId, but it's starting at s+10, instead of just s. The
variable s points to the first byte after the "msg=audit(" prefix. (10 also
happens to be the length of that prefix, which is what made me suspicious
this might not be micro-optimization)

-Santosh

[-- Attachment #1.2: Type: text/html, Size: 1190 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-14 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10  2:10 Weird timestamp length constraint in auparse.c Santosh Ananthakrishnan
2015-12-14 21:02 ` Steve Grubb
2015-12-14 21:24   ` Santosh Ananthakrishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox