snmp_trap_header_sum(): use strlen() to get the length of community string

Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
This commit is contained in:
Freddie Chopin 2014-02-03 12:36:03 +01:00 committed by sg
parent b5b5844119
commit 9b4564d7f3

View File

@ -52,6 +52,8 @@
#include "lwip/snmp_asn1.h"
#include "lwip/snmp_msg.h"
#include <string.h>
struct snmp_trap_dst
{
/* destination IP address in network order */
@ -398,7 +400,7 @@ snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len)
snmp_asn1_enc_length_cnt(thl->pdulen, &thl->pdulenlen);
tot_len += 1 + thl->pdulenlen;
thl->comlen = sizeof(snmp_publiccommunity) - 1;
thl->comlen = strlen(snmp_publiccommunity);
snmp_asn1_enc_length_cnt(thl->comlen, &thl->comlenlen);
tot_len += 1 + thl->comlenlen + thl->comlen;