Use strlcpy when copying com
to pdu->community to avoid potential
buffer overruns MFC after: 1 week Reported by: Coverity CID: 1006823, 1006824
This commit is contained in:
parent
c4114bd1f5
commit
8e02b381d3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310957
@ -422,7 +422,7 @@ snmp_create_v1_trap(struct snmp_pdu *pdu, char *com,
|
||||
const struct asn_oid *trap_oid)
|
||||
{
|
||||
memset(pdu, 0, sizeof(*pdu));
|
||||
strcpy(pdu->community, com);
|
||||
strlcpy(pdu->community, com, sizeof(pdu->community));
|
||||
|
||||
pdu->version = SNMP_V1;
|
||||
pdu->type = SNMP_PDU_TRAP;
|
||||
@ -439,7 +439,7 @@ snmp_create_v2_trap(struct snmp_pdu *pdu, char *com,
|
||||
const struct asn_oid *trap_oid)
|
||||
{
|
||||
memset(pdu, 0, sizeof(*pdu));
|
||||
strcpy(pdu->community, com);
|
||||
strlcpy(pdu->community, com, sizeof(pdu->community));
|
||||
|
||||
pdu->version = SNMP_V2c;
|
||||
pdu->type = SNMP_PDU_TRAP2;
|
||||
|
Loading…
Reference in New Issue
Block a user