Re: snmp_api.c/snmp_pdu_parse() not initializing pointers

This is a discussion on Re: snmp_api.c/snmp_pdu_parse() not initializing pointers within the SNMP Coders forums, part of the Networking and Network Related category; Robert Story wrote: > On Thu, 15 Jun 2006 17:12:07 +0200 Gustaf wrote: > GG> If I ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-16-2006
Gustaf Gunnarsson
 
Posts: n/a
Default Re: snmp_api.c/snmp_pdu_parse() not initializing pointers

Robert Story wrote:
> On Thu, 15 Jun 2006 17:12:07 +0200 Gustaf wrote:
> GG> If I was instead chosing to malloc() a netsnmp_pdu same would apply,
> GG> only I would have to initialize *all* pointers inside the netsnmp_pdu in
> GG> order to ensure that snmp_free_pdu() wount do any unexpected things.
> GG>
> GG> This is quite problematic because any code written now would have to be
> GG> re-examined (or rather NetSNMP would have to be re-examined) if one were
> GG> to upgrade to a newer NetSNMP version wich *could* (I know this is not
> GG> likely, but ..) introduce new pointers inside the netsnmp_pdu structure.
>
> The best thing to do here is to simply memset the structure with 0x00, or use
> calloc to allocate it.


I understund this could be done. Not beeing a C expert I only know that
when I read the comp.lang.c FAQ they recommend against this, because it
is not guaranteed to work.

Is this only some theoretical/legacy rule which doesn't need to be
applied on common modern platforms (ie those who NetSNMP support) and
can hence safely be disregarded?

//Gustaf




_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:05 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0