Resolves: RHEL-121405 - fix use after free issue

Signed-off-by: Josef Ridky <jridky@redhat.com>
This commit is contained in:
Josef Ridky 2025-11-10 11:16:57 +01:00
parent 80704827ca
commit 9092d2647a
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
diff -urNp a/snmplib/callback.c b/snmplib/callback.c
--- a/snmplib/callback.c 2025-08-13 15:21:25.507544080 +0200
+++ b/snmplib/callback.c 2025-08-13 15:25:01.973092935 +0200
@@ -346,13 +346,17 @@ snmp_call_callbacks(int major, int minor
/*
* for each registered callback of type major and minor
*/
- for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
+ scp = thecallbacks[major][minor];
+ while (scp != NULL) {
+ struct snmp_gen_callback *scp_next = scp->next;
/*
* skip unregistered callbacks
*/
- if(NULL == scp->sc_callback)
+ if(NULL == scp->sc_callback) {
+ scp = scp_next;
continue;
+ }
DEBUGMSGTL(("callback", "calling a callback for maj=%d min=%d\n",
major, minor));
@@ -363,6 +367,8 @@ snmp_call_callbacks(int major, int minor
(*(scp->sc_callback)) (major, minor, caller_arg,
scp->sc_client_arg);
count++;
+
+ scp = scp_next;
}
DEBUGMSGTL(("callback",

View File

@ -10,7 +10,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.9.4
Release: 16%{?dist}
Release: 17%{?dist}
Epoch: 1
License: MIT-CMU and BSD-3-Clause and MIT and OpenSSL
@ -55,6 +55,7 @@ Patch25: net-snmp-5.9.4-kernel-6.7.patch
Patch26: net-snmp-5.9.4-remove-mail-sender.patch
Patch27: net-snmp-5.9.4-tls.patch
Patch28: net-snmp-5.9.4-revert-n-snmptrapd-log.patch
Patch29: net-snmp-5.8-callback-fix.patch
# Modern RPM API means at least EL6
Patch101: net-snmp-5.8-modern-rpm-api.patch
@ -249,6 +250,7 @@ cp %{SOURCE10} .
%patch 26 -p1 -b .remove-mail-sender
%patch 27 -p1 -b .tls
%patch 28 -p1 -b .revert-n-snmptrapd-log
%patch 29 -p1 -b .callback-fix
%patch 101 -p1 -b .modern-rpm-api
%patch 102 -p1
@ -519,6 +521,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
%{_libdir}/libnetsnmptrapd*.so.%{soname}*
%changelog
* Mon Nov 10 2025 Josef Ridky <jridky@redhat.com> - 1:5.9.4-17
- fix use after free issue (RHEL-121405)
* Wed Sep 03 2025 Josef Ridky <jridky@redhat.com> - 1:5.9.4-16
- Enable PQC in net-snmp (RHEL-93087)
- Fix inverted use of -n in snmptrapd_log.c (RHEL-110514)