diff --git a/backport-ping-Fix-potential-memory-leakage.patch b/backport-ping-Fix-potential-memory-leakage.patch new file mode 100644 index 0000000..c7b5988 --- /dev/null +++ b/backport-ping-Fix-potential-memory-leakage.patch @@ -0,0 +1,32 @@ +From 626ea66f3d54ba6e749230d3aa0ce8f4ddfded9c Mon Sep 17 00:00:00 2001 +From: lvgenggeng +Date: Tue, 31 May 2022 08:37:38 +0800 +Subject: [PATCH] ping: Fix potential memory leakage + +If user use '-p' opt multi-times, the previous pointer generated by +strdup() will be discarded. + +Closes: https://github.com/iputils/iputils/pull/409 + +Reviewed-by: Cyril Hrubis +Reviewed-by: Petr Vorel +Signed-off-by: lvgenggeng +--- + ping/ping.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ping/ping.c b/ping/ping.c +index 8a7f701..10f2cf3 100644 +--- a/ping/ping.c ++++ b/ping/ping.c +@@ -449,6 +449,7 @@ main(int argc, char **argv) + break; + case 'p': + rts.opt_pingfilled = 1; ++ free(outpack_fill); + outpack_fill = strdup(optarg); + if (!outpack_fill) + error(2, errno, _("memory allocation failed")); +-- +2.27.0 + diff --git a/iputils.spec b/iputils.spec index ccc5878..78d0741 100644 --- a/iputils.spec +++ b/iputils.spec @@ -1,6 +1,6 @@ Name: iputils Version: 20210722 -Release: 5 +Release: 6 Summary: Network monitoring tools including ping License: BSD and GPLv2+ URL: https://github.com/iputils/iputils @@ -22,6 +22,7 @@ Patch0006: backport-ping6-Avoid-binding-to-non-VRF.patch Patch0007: arping-Fix-exit-code-on-w-option.patch Patch0008: backport-ping-Print-reply-from-Subnet-Router-anycast-address.patch Patch0009: backport-ping-Print-reply-with-wrong-source-with-warning.patch +Patch0010: backport-ping-Fix-potential-memory-leakage.patch BuildRequires: gcc meson libidn2-devel openssl-devel libcap-devel libxslt BuildRequires: docbook5-style-xsl systemd iproute glibc-kernheaders gettext @@ -120,6 +121,12 @@ install -cp ifenslave.8 ${RPM_BUILD_ROOT}%{_mandir}/man8/ %{_unitdir}/ninfod.service %changelog +* Mon Jun 20 2022 lvgenggeng - 20210722-6 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:backport to fix potential memory leakage on -p option + * Sat May 07 2022 eaglegai - 20210722-5 - Type:bugfix - ID:NA