[AGENT++] [SNMP++] Various bug fixes & observations

Jochen Katz katz at agentpp.com
Wed Feb 16 22:56:00 CET 2011


Hi,

> #1  [BUFFER OVERRUN]
> 
> The write at "..\snmp++\src\auth_priv.cpp" at line 2185 is past end of the 
> array.

I don't think so, the dec_buffer_len is modified and is smaller than 80.

> #2  [ENHANCEMENT]
> 
> In "..\snmp++\src\uxsnmp.cpp" change the start of Snmp::process_thread() 
>         ::ResetEvent(pSnmp->m_hThreadEndEvent);
> 
> This permits the thread to be repeatedly started and stopped with 
> Snmp::start_poll_thread() and Snmp::stop_poll_thread(). Without the patch, 
> the call to ::WaitForSingleObject() within Snmp::stop_poll_thread() will be 
> immediately satisfied after the first pass, which could permit the Snmp 
> object to be deleted at a higher level whilst the thread is still running.

Sounds convincing. Any objections from a windows programming expert? If
not, it will be changed.

> #3  [Memory leak]
> 
> In "...\agent++\include\agent_pp\request.h", at line 639, change 
> delete_lock_queue() to a static member. This can then be used without an 
> object to tidy up memory before the program terminates:

Ok.

> #4  [HEADER FIX]
> 
> Change "...\snmp++\include\snmp_pp\address.h" line 86 from:
> 
>     #if !defined(_AIX) && !defined(__QNX_NEUTRINO)
> to:
>     #if !defined(_AIX)
> 
> This modification removes the QNX specialisation around the inclusion of the 
> "unistd.h" header. From QNX Version 6.3.0* (possibly earlier) the close() 
> function is correctly defined within the header (i.e. they are now POSIX 
> compliant).
> (*) Released in 2004.

Any comment from another QNX user? If not it wll be changed.

> #5  [UNUSED & UNREACHABLE CODE]
> 
> In "..\agent++\src\mib.cpp", the constructor "MibTable::MibTable(const Oidx& 
> o, unsigned int ilen, boolean a)" does not use the boolean parameter. Also,
> the implementation contains unreachable code, since the the ilen parameter 
> is unsigned. Similar unreachable code is also present within the constructor 
> "MibTable::MibTable(const Oidx& o, unsigned int ilen)".

The constructor with bool param is marked as deprecated. As this
deprecated note was added by Frank, its up to him, to remove the
complete constructor. For both constructors I changed the param from
unsigned int to int, as this is, what the documentation says.

> #6  [OBSERVATION]

Maybe we should add this to the documentation ;-)

Thanks and Regards,
  Jochen



More information about the AGENTPP mailing list