Date: Sat, 31 Dec 2016 12:18:17 +0000 (UTC) From: Ngie Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310957 - head/contrib/bsnmp/snmpd Message-ID: <201612311218.uBVCIHlm072042@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sat Dec 31 12:18:17 2016 New Revision: 310957 URL: https://svnweb.freebsd.org/changeset/base/310957 Log: Use strlcpy when copying `com` to pdu->community to avoid potential buffer overruns MFC after: 1 week Reported by: Coverity CID: 1006823, 1006824 Modified: head/contrib/bsnmp/snmpd/trap.c Modified: head/contrib/bsnmp/snmpd/trap.c ============================================================================== --- head/contrib/bsnmp/snmpd/trap.c Sat Dec 31 12:16:21 2016 (r310956) +++ head/contrib/bsnmp/snmpd/trap.c Sat Dec 31 12:18:17 2016 (r310957) @@ -422,7 +422,7 @@ snmp_create_v1_trap(struct snmp_pdu *pdu 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 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612311218.uBVCIHlm072042>