mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-17 11:42:56 +00:00
Fix community string length copying - correctly handle long strings
This commit is contained in:
parent
8d149e63a6
commit
2673e635a3
@ -821,8 +821,9 @@ snmp_parse_inbound_frame(struct snmp_request *request)
|
||||
|
||||
/* SNMPv3 doesn't use communities */
|
||||
/* @todo: Differentiate read/write access */
|
||||
strncpy((char*)request->community, snmp_community, sizeof(request->community));
|
||||
request->community_strlen = (u16_t)strnlen((char*)request->community, sizeof(request->community));
|
||||
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);
|
||||
|
||||
/* RFC3414 globalData */
|
||||
IF_PARSE_EXEC(snmp_asn1_dec_tlv(&pbuf_stream, &tlv));
|
||||
|
Loading…
x
Reference in New Issue
Block a user