------------------------------------------------------------ revno: 11829 revision-id: squid3@treenet.co.nz-20140915045953-80r0d5mn4ztghldi parent: squid3@treenet.co.nz-20140827143622-aj6y1q5khr7txsa7 author: Sebastian Krahmer committer: Amos Jeffries branch nick: 3.2 timestamp: Sun 2014-09-14 22:59:53 -0600 message: Fix off by one in SNMP subsystem ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140915045953-80r0d5mn4ztghldi # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: 722ff754af8134e95151b02afc67dc3c9f4a32b1 # timestamp: 2014-09-15 11:09:35 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20140827143622-\ # aj6y1q5khr7txsa7 # # Begin patch === modified file 'src/snmp_core.cc' --- a/src/snmp_core.cc 2012-10-17 00:39:25 +0000 +++ b/src/snmp_core.cc 2014-09-15 04:59:53 +0000 @@ -356,7 +356,7 @@ void snmpHandleUdp(int sock, void *not_used) { - LOCAL_ARRAY(char, buf, SNMP_REQUEST_SIZE); + static char buf[SNMP_REQUEST_SIZE]; Ip::Address from; snmp_request_t *snmp_rq; int len; @@ -365,16 +365,11 @@ Comm::SetSelect(sock, COMM_SELECT_READ, snmpHandleUdp, NULL, 0); - memset(buf, '\0', SNMP_REQUEST_SIZE); + memset(buf, '\0', sizeof(buf)); - len = comm_udp_recvfrom(sock, - buf, - SNMP_REQUEST_SIZE, - 0, - from); + len = comm_udp_recvfrom(sock, buf, sizeof(buf)-1, 0, from); if (len > 0) { - buf[len] = '\0'; debugs(49, 3, "snmpHandleUdp: FD " << sock << ": received " << len << " bytes from " << from << "."); snmp_rq = (snmp_request_t *)xcalloc(1, sizeof(snmp_request_t));