diff options
author | Jun Kuriyama <kuriyama@FreeBSD.org> | 2005-03-22 08:32:48 +0000 |
---|---|---|
committer | Jun Kuriyama <kuriyama@FreeBSD.org> | 2005-03-22 08:32:48 +0000 |
commit | a3597c82c28ab7d9aaf7926adb75b1f7490b932f (patch) | |
tree | 033be3002384478c54207ecb0e6a3f7c73d9d3ad /net-mgmt/net-snmp53/files | |
parent | d87abb1b71be11f64fbc8213bdd63b5cf115b80b (diff) | |
download | ports-a3597c82c28ab7d9aaf7926adb75b1f7490b932f.tar.gz ports-a3597c82c28ab7d9aaf7926adb75b1f7490b932f.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)
Notes
Notes:
svn path=/head/; revision=131884
Diffstat (limited to 'net-mgmt/net-snmp53/files')
-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 |
2 files changed, 58 insertions, 2 deletions
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>"); |