
I have been investigating a possible problem with the function findNodeByParentAndSubid() in LibSMI's data.c file (v0.4.8). This function makes a comparison with smiHandle->parserPtr->pendingPtr. However, as far as I can tell, the parserPtr member of smiHandle is only ever set to point to a local variable (see the smiInitData() and loadModule() functions). This is fine when the local variable is still in scope (i.e. when findNodeByParentAndSubid() is called from within either the smiInitData() or loadModule() functions). The problem is that findNodeByParentAndSubid() is also called from getNode(), which is itself called from smiGetNode(). I was hoping to be able to call smiGetNode() from any point in the code, after the smiInitData() and loadModule() had already completed.
If parserPtr goes out of scope and is re-used then the result of the comparison in findNodeByParentAndSubid() is affected. If pendingNodePtr ever gets set to the same value as parentNodePtr then the 'for' loop is skipped and NULL is returned.
My workaround for now has been to modify findNodeByParentAndSubid() so that the comparison with parserPtr->pendingNodePtr is only carried out during initialisation (when safely being called from the smiInitData() or loadModule() functions).
I am not completely clear as to the purpose of the pendingNodePtr or the comparison made in findNodeByParentAndSubid(). If anyone with a better understanding of LibSMI could comment or investigate, I would be grateful for any assistance.
Thanks
Damien Scott
participants (1)
-
Scott, Damien