diff options
author | kuriyama <kuriyama@FreeBSD.org> | 2005-03-22 16:32:48 +0800 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 2005-03-22 16:32:48 +0800 |
commit | ae098a4c62fff6f2749ff755f6635d2165d5b538 (patch) | |
tree | de99ce723a40ea2e227122fb82a8ed60421d65e1 /net-mgmt/net-snmp53 | |
parent | b51b2786ccba1242c29d957f290dd646fe5811a8 (diff) | |
download | freebsd-ports-gnome-ae098a4c62fff6f2749ff755f6635d2165d5b538.tar.gz freebsd-ports-gnome-ae098a4c62fff6f2749ff755f6635d2165d5b538.tar.zst freebsd-ports-gnome-ae098a4c62fff6f2749ff755f6635d2165d5b538.zip |
(1) Fix memory leak by connections from <UNKNOWN>.
(2) Take care of large counters on 64bit platforms.
PR: ports/78807 (1)
Submitted by: Andriy Gapon <avg@icyb.net.ua> (1),
Peter Losher <Peter_Losher@isc.org> (2)
Approved by: portmgr (marcus)
Diffstat (limited to 'net-mgmt/net-snmp53')
-rw-r--r-- | net-mgmt/net-snmp53/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-asn1.c | 50 | ||||
-rw-r--r-- | net-mgmt/net-snmp53/files/patch-snmp_agent.c | 10 |
3 files changed, 59 insertions, 3 deletions
diff --git a/net-mgmt/net-snmp53/Makefile b/net-mgmt/net-snmp53/Makefile index ec13bc7f3e2f..1984da372a48 100644 --- a/net-mgmt/net-snmp53/Makefile +++ b/net-mgmt/net-snmp53/Makefile @@ -7,7 +7,7 @@ PORTNAME= snmp PORTVERSION= 5.2.1 -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMEPREFIX= net- CATEGORIES= net-mgmt ipv6 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} diff --git a/net-mgmt/net-snmp53/files/patch-asn1.c b/net-mgmt/net-snmp53/files/patch-asn1.c index 477a909b07b9..8dc5fe0108d6 100644 --- a/net-mgmt/net-snmp53/files/patch-asn1.c +++ b/net-mgmt/net-snmp53/files/patch-asn1.c @@ -1,5 +1,5 @@ ---- snmplib/asn1.c.orig Tue Jan 25 10:09:35 2005 -+++ snmplib/asn1.c Tue Jan 25 10:09:55 2005 +--- snmplib/asn1.c.orig.2 Sat Dec 11 00:07:16 2004 ++++ snmplib/asn1.c Thu Feb 24 23:42:30 2005 @@ -181,6 +181,9 @@ #include <in.h> #endif @@ -10,3 +10,49 @@ #if HAVE_DMALLOC_H #include <dmalloc.h> #endif +@@ -584,6 +587,11 @@ + return NULL; + } + integer = *intp; ++ if (intsize > 4) { ++ register u_long signmask = ((u_long)1 << ((8 * sizeof(long)) - 1)); ++ register u_long signbit = ((integer & signmask) != 0); ++ integer &= (signbit << 31) | 0x7fffffff; ++ } + /* + * Truncate "unnecessary" bytes off of the most significant end of this + * 2's complement integer. There should be no sequence of 9 +@@ -663,6 +671,9 @@ + return NULL; + } + integer = *intp; ++ if (intsize > 4) { ++ integer &= 0xffffffff; ++ } + mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1)); + /* + * mask is 0xFF000000 on a big-endian machine +@@ -2674,6 +2685,12 @@ + return 0; + } + ++ if (intsize > 4) { ++ register u_long signmask = ((u_long)1 << ((8 * sizeof(long)) - 1)); ++ register u_long signbit = ((integer & signmask) != 0); ++ integer &= (signbit << 31) | 0x7fffffff; ++ } ++ + if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) { + return 0; + } +@@ -2823,6 +2840,10 @@ + if (intsize != sizeof(unsigned long)) { + _asn_size_err(errpre, intsize, sizeof(unsigned long)); + return 0; ++ } ++ ++ if (intsize > 4) { ++ integer &= 0xffffffff; + } + + if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) { diff --git a/net-mgmt/net-snmp53/files/patch-snmp_agent.c b/net-mgmt/net-snmp53/files/patch-snmp_agent.c new file mode 100644 index 000000000000..735b7fbbc753 --- /dev/null +++ b/net-mgmt/net-snmp53/files/patch-snmp_agent.c @@ -0,0 +1,10 @@ +--- agent/snmp_agent.c.orig Tue Mar 22 11:11:51 2005 ++++ agent/snmp_agent.c Tue Mar 22 11:12:29 2005 +@@ -825,6 +825,7 @@ + return 0; + } + } else { ++ SNMP_FREE(addr_string); + if (hosts_ctl("snmpd", STRING_UNKNOWN, STRING_UNKNOWN, STRING_UNKNOWN)){ + snmp_log(allow_severity, "Connection from <UNKNOWN>\n"); + addr_string = strdup("<UNKNOWN>"); |