All of lore.kernel.org
 help / color / mirror / Atom feed
* new auparse question
@ 2011-08-31 20:31 LC Bruzenak
  2011-08-31 20:49 ` Steve Grubb
  0 siblings, 1 reply; 3+ messages in thread
From: LC Bruzenak @ 2011-08-31 20:31 UTC (permalink / raw)
  To: Linux Audit

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

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

* Re: new auparse question
  2011-08-31 20:31 new auparse question LC Bruzenak
@ 2011-08-31 20:49 ` Steve Grubb
  2011-09-01  0:55   ` Steve Grubb
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Grubb @ 2011-08-31 20:49 UTC (permalink / raw)
  To: linux-audit

On Wednesday, August 31, 2011 04:31:48 PM LC Bruzenak wrote:
> 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?

A segfault is a bug as far as this library is concerned. I know other libraries let 
you segfault if you do something wrong. I'll try to make a reproducer and see what's 
going on.

-Steve

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

* Re: new auparse question
  2011-08-31 20:49 ` Steve Grubb
@ 2011-09-01  0:55   ` Steve Grubb
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Grubb @ 2011-09-01  0:55 UTC (permalink / raw)
  To: linux-audit

On Wednesday, August 31, 2011 04:49:46 PM Steve Grubb wrote:
> On Wednesday, August 31, 2011 04:31:48 PM LC Bruzenak wrote:
> > 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?
> 
> A segfault is a bug as far as this library is concerned. I know other
> libraries let you segfault if you do something wrong. I'll try to make a
> reproducer and see what's going on.

Patch applied to svn:
https://fedorahosted.org/audit/changeset/567

-Steve

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

end of thread, other threads:[~2011-09-01  0:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 20:31 new auparse question LC Bruzenak
2011-08-31 20:49 ` Steve Grubb
2011-09-01  0:55   ` Steve Grubb

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.