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; break;
} }
case ASN_OCTET_STR: // 4 case ASN_OCTET_STR: // 4
*snmplen = strlen(snmpstr)+1; *snmplen = strlen(snmpstr);
if ((*snmpval = (u_char*)strdup((snmpstr))) == NULL){ if ((*snmpval = malloc(*snmplen)) == NULL){
clixon_err(OE_UNIX, errno, "strdup"); clixon_err(OE_UNIX, errno, "malloc");
goto done; goto done;
} }
memcpy(*snmpval, snmpstr, *snmplen);
break; break;
case ASN_COUNTER64:{ // 0x46 / 70 case ASN_COUNTER64:{ // 0x46 / 70
uint64_t u64; uint64_t u64;