From dc172512d8e1666b233246b26c57daa403247b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0afr=C3=A1nek?= Date: Mon, 8 Oct 2007 09:28:31 +0000 Subject: [PATCH] fix segfault on parsing smuxpeer without password Resolves: #316621 --- net-snmp-5.4-smux-password.patch | 73 ++++++++++++++++++++++++++++++++ net-snmp.spec | 7 ++- 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 net-snmp-5.4-smux-password.patch diff --git a/net-snmp-5.4-smux-password.patch b/net-snmp-5.4-smux-password.patch new file mode 100644 index 0000000..0697a9f --- /dev/null +++ b/net-snmp-5.4-smux-password.patch @@ -0,0 +1,73 @@ +Source: svn diff -r 15941:15942 +Reviewed-By: Jan Safranek + +Index: agent/mibgroup/smux/smux.c +=================================================================== +--- agent/mibgroup/smux/smux.c (revision 15941) ++++ agent/mibgroup/smux/smux.c (revision 15942) +@@ -150,42 +150,40 @@ + config_perror("Too many smuxpeers"); + return; + } +- aptr->sa_active_fd = -1; +- if (!cptr) { +- /* +- * null passwords OK +- */ +- Auths[nauths++] = aptr; +- DEBUGMSGTL(("smux_conf", "null password\n")); +- return; +- } + + /* + * oid + */ +- password_cptr = strchr(cptr, ' '); +- cptr_len = strlen(cptr); +- if (password_cptr) +- *password_cptr = 0x0; +- ++ aptr->sa_active_fd = -1; + aptr->sa_oid_len = MAX_OID_LEN; + read_objid( cptr, aptr->sa_oid, &aptr->sa_oid_len ); +- + DEBUGMSGTL(("smux_conf", "parsing registration for: %s\n", cptr)); + +- if ((&password_cptr - &cptr + 1) < cptr_len) { +- cptr = ++password_cptr; +- DEBUGMSGTL(("smux_conf", "password is: %s\n", +- SNMP_STRORNULL(cptr))); +- } ++ password_cptr = strchr(cptr, ' '); ++ cptr_len = strlen(cptr); + +- /* +- * password +- */ +- if (cptr) +- strcpy(aptr->sa_passwd, cptr); ++ if (password_cptr != NULL) { /* Do we have a password or not? */ ++ *password_cptr = 0x0; ++ if ((&password_cptr - &cptr + 1) < cptr_len) { ++ cptr = ++password_cptr; ++ DEBUGMSGTL(("smux_conf", "password is: %s\n", ++ SNMP_STRORNULL(cptr))); ++ } + ++ /* ++ * password ++ */ ++ if (cptr) ++ strcpy(aptr->sa_passwd, cptr); ++ } else { ++ /* ++ * null passwords OK ++ */ ++ DEBUGMSGTL(("smux_conf", "null password\n")); ++ } ++ + Auths[nauths++] = aptr; ++ return; + } + + void diff --git a/net-snmp.spec b/net-snmp.spec index da9f4f2..0223780 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -7,7 +7,7 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: %{major_ver} -Release: 14%{?dist} +Release: 15%{?dist} Epoch: 1 License: MIT @@ -43,6 +43,7 @@ Patch18: net-snmp-5.4-udp-endpoint.patch Patch19: net-snmp-5.3.1-shared-ip.patch Patch20: net-snmp-5.3.1-mib-option.patch Patch21: net-snmp-5.4-exec-crash.patch +Patch22: net-snmp-5.4-smux-password.patch Requires(pre): /sbin/chkconfig Requires(post): /sbin/chkconfig @@ -165,6 +166,7 @@ and applications. %patch19 -p1 -b .shared-ip %patch20 -p1 -b .mib-option %patch21 -p1 -b .exec-crash +%patch22 -p0 -b .smux-password # Do this patch with a perl hack... perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh @@ -369,8 +371,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/lib*.so.* %changelog -* Tue Aug 7 2007 Jan Safranek 5.4-15 +* Mon Oct 8 2007 Jan Safranek 5.4-15 - License: field changed to MIT +- fix segfault on parsing smuxpeer without password (#316621) * Thu Jun 28 2007 Jan Safranek 5.4-14 - fix snmptrapd hostname logging (#238587)