SNMP octet scring has a defined length and does not need a null separator

This commit is contained in:
Mico Micic 2024-02-12 16:00:53 +01:00 committed by Olof Hagsand
parent 4138f390d4
commit 891b0b0c9e

View file

@ -917,11 +917,12 @@ type_xml2snmp(char *snmpstr,
break;
}
case ASN_OCTET_STR: // 4
*snmplen = strlen(snmpstr)+1;
if ((*snmpval = (u_char*)strdup((snmpstr))) == NULL){
clixon_err(OE_UNIX, errno, "strdup");
*snmplen = strlen(snmpstr);
if ((*snmpval = malloc(*snmplen)) == NULL){
clixon_err(OE_UNIX, errno, "malloc");
goto done;
}
memcpy(*snmpval, snmpstr, *snmplen);
break;
case ASN_COUNTER64:{ // 0x46 / 70
uint64_t u64;