public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: LC Bruzenak <lenny@magitekltd.com>
To: Linux Audit <linux-audit@redhat.com>
Subject: new auparse question
Date: Wed, 31 Aug 2011 15:31:48 -0500	[thread overview]
Message-ID: <1314822708.2094.127.camel@lcb> (raw)

I have an issue now with auparse_find_field.
I work around it fine though but maybe it's worth reporting.
There is a place where I do this:

const char *result;
...
result=auparse_find_field(au, "res");

and get a segfault.


If I instead do this:
const char *result;
...
auparse_first_field(au);
result=auparse_find_field(au, "res");

then it is fine.


A quick gdb test shows me :

0x00007ffff7dd2a7d in nvlist_get_cur_name (au=0x617a90, name=0x4022a8
"res") at nvlist.h:40
40	static inline const char *nvlist_get_cur_name(const nvlist *l)
{return l->cur->name;}


Looking at my own code, I believe I previously had walked through the
event record using this loop:
...
auparse_first_field(au);
do {
...
} while (auparse_next_field(au) > 0);
...

and so I guess that the "cur" field was undefined when used the
auparse_find_field call.

It (auparse_find_field) calls:
...
cur_name = nvlist_get_cur_name(&r->nv);

and I guess that's were the problem happened.

So my question is - is this a bug (I would think so) or should I always
precede any auparse call sequence with at least one fresh
auparse_first_field call?

Thx,
LCB

-- 
LC (Lenny) Bruzenak
lenny@magitekltd.com

             reply	other threads:[~2011-08-31 20:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 20:31 LC Bruzenak [this message]
2011-08-31 20:49 ` new auparse question Steve Grubb
2011-09-01  0:55   ` 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=1314822708.2094.127.camel@lcb \
    --to=lenny@magitekltd.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