From 15e9455ea69de5f4fcac2e9ab0b533548a2b1bfc Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Mon, 4 Mar 2024 09:38:57 -0500 Subject: [PATCH] rpcb_clnt.c: memory leak in destroy_addr (RHEL-11370) JIRA: https://issues.redhat.com/browse/RHEL-11370 commit 89c63bdfd79b1c94384daaaa03a9e3582540f843 Author: Herb Wartens Date: Tue Aug 1 10:21:42 2023 -0400 rpcb_clnt.c: memory leak in destroy_addr Null pointers so they are not used again Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2225226 Signed-off-by: Steve Dickson Signed-off-by: Steve Dickson Resolves: RHEL-11370 --- libtirpc-1.1.4-null-ptrs-not-reused.patch | 48 +++++++++++++++++++++++ libtirpc.spec | 8 ++++ 2 files changed, 56 insertions(+) create mode 100644 libtirpc-1.1.4-null-ptrs-not-reused.patch diff --git a/libtirpc-1.1.4-null-ptrs-not-reused.patch b/libtirpc-1.1.4-null-ptrs-not-reused.patch new file mode 100644 index 0000000..f2fc9f2 --- /dev/null +++ b/libtirpc-1.1.4-null-ptrs-not-reused.patch @@ -0,0 +1,48 @@ +commit 89c63bdfd79b1c94384daaaa03a9e3582540f843 +Author: Herb Wartens +Date: Tue Aug 1 10:21:42 2023 -0400 + + rpcb_clnt.c: memory leak in destroy_addr + + Null pointers so they are not used again + + Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2225226 + Signed-off-by: Steve Dickson + +diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c +index d178d86..c0a9e12 100644 +--- a/src/rpcb_clnt.c ++++ b/src/rpcb_clnt.c +@@ -104,17 +104,27 @@ destroy_addr(addr) + { + if (addr == NULL) + return; +- if(addr->ac_host != NULL) ++ if (addr->ac_host != NULL) { + free(addr->ac_host); +- if(addr->ac_netid != NULL) ++ addr->ac_host = NULL; ++ } ++ if (addr->ac_netid != NULL) { + free(addr->ac_netid); +- if(addr->ac_uaddr != NULL) ++ addr->ac_netid = NULL; ++ } ++ if (addr->ac_uaddr != NULL) { + free(addr->ac_uaddr); +- if(addr->ac_taddr != NULL) { +- if(addr->ac_taddr->buf != NULL) ++ addr->ac_uaddr = NULL; ++ } ++ if (addr->ac_taddr != NULL) { ++ if(addr->ac_taddr->buf != NULL) { + free(addr->ac_taddr->buf); ++ addr->ac_taddr->buf = NULL; ++ } ++ addr->ac_taddr = NULL; + } + free(addr); ++ addr = NULL; + } + + /* diff --git a/libtirpc.spec b/libtirpc.spec index a259868..dc31c64 100644 --- a/libtirpc.spec +++ b/libtirpc.spec @@ -47,6 +47,11 @@ Patch008: libtirpc-1.1.4-v2proto-mech.patch # bz 2112116 Patch009: libtirpc-1.1.4-multithr-cleanup.patch +# +# RHEL 8.10 +# +Patch010: libtirpc-1.1.4-null-ptrs-not-reused.patch + BuildRequires: automake, autoconf, libtool, pkgconfig BuildRequires: krb5-devel @@ -166,6 +171,9 @@ mv %{buildroot}%{_mandir}/man3 %{buildroot}%{_mandir}/man3t %{_mandir}/*/* %changelog +* Mon Mar 4 2024 Steve Dickson 1.1.4-9 +- Null pointers so they are not used again (RHEL-11370) + * Wed Aug 3 2022 Steve Dickson 1.1.4-8 - rpcb_clnt.c add mechanism to try v2 protocol first (bz 2107650) - Multithreaded cleanup (bz 2112116)