On 18 March 2010 10:50, sanjaykumar <[email protected]> wrote:
> I am not telling to remove the validation but update it
> eg:
> In below code udpEndpointLocalAddress is an array hence "(NULL ==
> tbl_idx->udpEndpointLocalAddress) " will be never VALID.
With the current code, that appears to be true.
The existing data structure seems to use a fixed array buffer,
so the buffer pointer will indeed never be NULL.
So that particular test is not strictly necessary
(and may well be optimised away by the compiler).
I believe it's valid, but will never match, so won't be doing any harm.
And bear in mind that if the data structure was ever changed
to use dynamic buffers (unlikely, but not inconceivable), then
this protection might well be useful.
> What is my concern that MODIFY it like below or something else
> so that check should be valid
>
> if (('\0' == tbl_idx->udpEndpointLocalAddress[0]) ||
But that's changing the meaning of the test.
As it stands, the checks are meant to ensure that there is
a buffer present and big enough to accept the new value.
What that buffer contained previously is not important.
It's going to be overwritten anyway.
By changing the test to look at the first octet of this buffer:
a) this would crash the agent if the buffer was ever missing
(e.g. following a switch to dynamic allocation)
b) the tests would start to fail if passed an empty buffer.
(as might well be the case the first time this routine was called).
However, we're now getting into the detailed operation of the MfD
framework, so I'll leave any further discussion to someone who knows
this better than me.
Dave
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders