fix segfault on parsing smuxpeer without password Resolves: #316621

This commit is contained in:
Jan Šafránek 2007-10-08 09:28:31 +00:00
parent 9f2ff9bbc2
commit dc172512d8
2 changed files with 78 additions and 2 deletions

View File

@ -0,0 +1,73 @@
Source: svn diff -r 15941:15942
Reviewed-By: Jan Safranek <jsafrane@redhat.com>
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

View File

@ -7,7 +7,7 @@
Summary: A collection of SNMP protocol tools and libraries Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp Name: net-snmp
Version: %{major_ver} Version: %{major_ver}
Release: 14%{?dist} Release: 15%{?dist}
Epoch: 1 Epoch: 1
License: MIT License: MIT
@ -43,6 +43,7 @@ Patch18: net-snmp-5.4-udp-endpoint.patch
Patch19: net-snmp-5.3.1-shared-ip.patch Patch19: net-snmp-5.3.1-shared-ip.patch
Patch20: net-snmp-5.3.1-mib-option.patch Patch20: net-snmp-5.3.1-mib-option.patch
Patch21: net-snmp-5.4-exec-crash.patch Patch21: net-snmp-5.4-exec-crash.patch
Patch22: net-snmp-5.4-smux-password.patch
Requires(pre): /sbin/chkconfig Requires(pre): /sbin/chkconfig
Requires(post): /sbin/chkconfig Requires(post): /sbin/chkconfig
@ -165,6 +166,7 @@ and applications.
%patch19 -p1 -b .shared-ip %patch19 -p1 -b .shared-ip
%patch20 -p1 -b .mib-option %patch20 -p1 -b .mib-option
%patch21 -p1 -b .exec-crash %patch21 -p1 -b .exec-crash
%patch22 -p0 -b .smux-password
# Do this patch with a perl hack... # Do this patch with a perl hack...
perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh
@ -369,8 +371,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/lib*.so.* %{_libdir}/lib*.so.*
%changelog %changelog
* Tue Aug 7 2007 Jan Safranek <jsafranek@redhat.com> 5.4-15 * Mon Oct 8 2007 Jan Safranek <jsafranek@redhat.com> 5.4-15
- License: field changed to MIT - License: field changed to MIT
- fix segfault on parsing smuxpeer without password (#316621)
* Thu Jun 28 2007 Jan Safranek <jsafranek@redhat.com> 5.4-14 * Thu Jun 28 2007 Jan Safranek <jsafranek@redhat.com> 5.4-14
- fix snmptrapd hostname logging (#238587) - fix snmptrapd hostname logging (#238587)