From 3bd84aba4b13e4257b02c87e543a0e3b9048f6f1 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Mon, 19 Nov 2018 20:13:30 +0100 Subject: [PATCH] snmp_v3: use strlen, not strnlen strnlen is not portable. In this case, it does not matter as we zero-terminate the string before. Signed-off-by: Simon Goldschmidt --- src/apps/snmp/snmp_msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/snmp/snmp_msg.c b/src/apps/snmp/snmp_msg.c index b3d3c499..7f9e4296 100644 --- a/src/apps/snmp/snmp_msg.c +++ b/src/apps/snmp/snmp_msg.c @@ -834,7 +834,7 @@ snmp_parse_inbound_frame(struct snmp_request *request) /* @todo: Differentiate read/write access */ strncpy((char *)request->community, snmp_community, SNMP_MAX_COMMUNITY_STR_LEN); request->community[SNMP_MAX_COMMUNITY_STR_LEN] = 0; /* ensure NULL termination (strncpy does NOT guarantee it!) */ - request->community_strlen = (u16_t)strnlen((char *)request->community, SNMP_MAX_COMMUNITY_STR_LEN); + request->community_strlen = (u16_t)strlen((char *)request->community); /* RFC3414 globalData */ IF_PARSE_EXEC(snmp_asn1_dec_tlv(&pbuf_stream, &tlv));