RE: [libsmi] segfault during traversal of SMIv2 MIBs

A sequence of smiGetNextNode() calls retrieves nodes from just one module.
Sorry, I don't see what you intend to do. Do you want to traverse a tree that is made up of nodes from several modules? In that case, you should come up with a recursive function that uses smiGetFirst/NextChild().
That's exactly what I've intend to do, thanks for clarification.
I do not yet understand under which circumstances you get a node without a valid oid. Usually, this should not happen. E.g., when I parse the modules you've sent to me in a private mail, I don't get to such a situation.
I've send you a sample application where the error occurs, maybe this can help.
with Kind Regards, Henrik Puls

Puls, Henrik wrote:
[...] I've send you a sample application where the error occurs, maybe this can help.
Along with your sample code and your set of MIBs I could reconstruct the segmentation fault easily (on Linux). I found that two of your MIB modules contain not only "minor" warnings, but also real errors (close to the end of the "bba" and the "bca" modules, a second "--" closes the comment and makes the rest of the line syntactically incorrect.
If you use libsmi to do more with your MIB modules than just checking them (i.e., developing your own applications, like you do) you should first ensure that the MIB modules are error-free. The tool smilint helps you to ensure this.
Of course, libsmi should be robust enough even to handle incorrect modules without crashing. But unfortunately, it is not. Your suggested patch would fix a symptom, but not the cause, so I prefer not to apply it.

On Wed, Oct 06, 2004 at 02:58:04PM +0200, Frank Strau? wrote:
Of course, libsmi should be robust enough even to handle incorrect modules without crashing. But unfortunately, it is not. Your suggested patch would fix a symptom, but not the cause, so I prefer not to apply it.
I consider the patch to be an additional sanity check which does not really hurt (and we have many of those in the code already).
/js

Juergen Schoenwaelder wrote:
On Wed, Oct 06, 2004 at 02:58:04PM +0200, Frank Strau? wrote:
Of course, libsmi should be robust enough even to handle incorrect modules without crashing. But unfortunately, it is not. Your suggested patch would fix a symptom, but not the cause, so I prefer not to apply it.
I consider the patch to be an additional sanity check which does not really hurt (and we have many of those in the code already).
That's true. Very true. :-/ -- Ok, I've added it. Thanks again, Henrik!
participants (3)
-
Frank Strauß
-
Juergen Schoenwaelder
-
Puls, Henrik