!15 [sync] PR-10: fix double free

From: @openeuler-sync-bot 
Reviewed-by: @zengwefeng 
Signed-off-by: @zengwefeng
This commit is contained in:
openeuler-ci-bot 2022-03-28 02:12:08 +00:00 committed by Gitee
commit 1e158db931
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 1e00cd123044661fd4f921d1e7216ed9255bb3d1 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Tue, 1 Feb 2022 08:46:40 -0500
Subject: [PATCH] rpcbind: fix double free in init_transport
$ rpcbind -h 127.0.0.1
free(): double free detected in tcache 2
Aborted
Fixes: a6889bba949b ("Removed resource leaks from src/rpcbind.c")
Resolves: https://sourceforge.net/p/rpcbind/bugs/6/
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
src/rpcbind.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 25d8a90..ecebe97 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -552,8 +552,10 @@ init_transport(struct netconfig *nconf)
syslog(LOG_ERR, "cannot bind %s on %s: %m",
(hosts[nhostsbak] == NULL) ? "*" :
hosts[nhostsbak], nconf->nc_netid);
- if (res != NULL)
+ if (res != NULL) {
freeaddrinfo(res);
+ res = NULL;
+ }
continue;
} else
checkbind++;
--
1.8.3.1

View File

@ -3,7 +3,7 @@
Name: rpcbind
Version: 1.2.6
Release: 2
Release: 3
Summary: Universal addresses to RPC program number mapper
License: BSD
@ -27,6 +27,7 @@ Patch103: %{name}-0.2.4-systemd-service.patch
Patch104: %{name}-0.2.4-systemd-rundir.patch
Patch105: bugfix-rpcbind-GETADDR-return-client-ip.patch
Patch6001: CVE-2017-8779.patch
Patch6002: backport-fix-double-free-in-init_transport.patch
Patch9000: bugfix-listen-tcp-port-111.patch
Provides: portmap = %{version}-%{release}
@ -116,6 +117,12 @@ fi
%{_mandir}/man8/*.8.gz
%changelog
* Mon Feb 28 2022 quanhongfei <quanhongfei@h-partners.com> - 1.2.6-3
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:fix double free in init_transport
* Wed Feb 09 2022 yanglu <yanglu72@huawei.com> - 1.2.6-2
- Type:bugfix
- Id:NA