Hi,

problem:

"dumpx_send:    Could not format log-string" appears in the log file while 
debugging all tokens.

Cause:

An encrypted  snmp packet which is rather large.

-----------------------------
Snmp_debug.c
-----------------------------
Void debugmsg_hex(const char *token, const u_char * thedata, size_t len)
{
    u_char         *buf = NULL;
    size_t          buf_len = 0, out_len = 0;

    if (sprint_realloc_hexstring
        (&buf, &buf_len, &out_len, 1, thedata, len)) {
        if (buf != NULL) {
            debugmsg(token, "%s", buf);
        }
    } else {
        if (buf != NULL) {
            debugmsg(token, "%s [TRUNCATED]", buf);
        }
    }

    if (buf != NULL) {
        free(buf);
    }
}
-----------------------------
-----------------------------

sprint_realloc_hexstring is called with allow_realloc==1. Thus returning an 
array about 2048 bytes long and out_len=1234. The else part won't be called, 
since the array is reallocated to the needed size.

Caling debugmsg with an character string longer than LOGLENGTH==1024 will 
result in the above error message. The error message is printed in "int 
snmp_vlog(int priority, const char *format, va_list ap)"  snmp_logging.c

Solution?:

Either do not allow sprint_realloc_hexstringto realloc the character buffer or 
check after sprint_realloc_hexstring out_len and truncate the result yourself.

Should I create a patch for this?

Thanks,
David Ecker





------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to