Hi Folks:
 
I hope this it the right place to post this.
 
Building snmpd for win32, I've found the following bug.
 
In tools.c's netsnmp_getenv() version 5.2.1:
 
If the "temp = getenv(name);" on line 939 returns non NULL, the next interesting statement executed is:
 
if (temp) {
    setenv(name, temp, 1);
    SNMP_FREE(temp);
}
 
The SNMP_FREE(temp) errors because the pointer in temp was not allocated from the heap.
 
My local fix is to do this:
 
DWORD getenv_worked = 0;
 
temp = getenv(name);
 
if (temp) {
    getenv_worked = 1;
    DEBUGSGTL(.....);
}
 
and later:
 
if (temp) {
    setenv(name, temp, 1);
    if (getenv_worked == 0) {
        SNMP_FREE(temp);
    }
}
 
Thanks,
 
Dan

Reply via email to