new auparse question

LC Bruzenak lenny at magitekltd.com
Wed Aug 31 20:31:48 UTC 2011


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 at magitekltd.com




More information about the Linux-audit mailing list