From 4bb524872106929c9f783123681e8f1c8d3d3e0b Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Fri, 11 Feb 2022 17:06:49 +0100 Subject: [PATCH] libslirp-4.4.0-7.el9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix also socket.c, thanks to Marc-André Lureau - Related: #2000051 Signed-off-by: Jindrich Novy --- ...place-inet_ntoa-with-safer-inet_ntop.patch | 26 +++++++++++++++++-- libslirp.spec | 6 ++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/0002-Replace-inet_ntoa-with-safer-inet_ntop.patch b/0002-Replace-inet_ntoa-with-safer-inet_ntop.patch index 00dca1f..908b144 100644 --- a/0002-Replace-inet_ntoa-with-safer-inet_ntop.patch +++ b/0002-Replace-inet_ntoa-with-safer-inet_ntop.patch @@ -1,4 +1,4 @@ -From a2ef541ccf7899df63784da95526520d204ebc8b Mon Sep 17 00:00:00 2001 +From 849c972aa16a85c860f67d7e7f1fbe58e45187d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 9 Feb 2022 22:15:08 +0400 Subject: [PATCH 2/2] Replace inet_ntoa() with safer inet_ntop() @@ -14,8 +14,9 @@ Signed-off-by: Marc-André Lureau src/arp_table.c | 8 ++++++-- src/ip_icmp.c | 10 ++++++---- src/misc.c | 22 +++++++++++++--------- + src/socket.c | 5 +++-- src/udp.c | 5 +++-- - 4 files changed, 28 insertions(+), 17 deletions(-) + 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/arp_table.c b/src/arp_table.c index ba8c8a4eee88..3cf2ecc238bc 100644 @@ -124,6 +125,27 @@ index e6bc0a207d0b..1306f68eb539 100644 so->so_rcv.sb_cc, so->so_snd.sb_cc); } +diff --git a/src/socket.c b/src/socket.c +index c0b02ad131f3..6607e319ad6c 100644 +--- a/src/socket.c ++++ b/src/socket.c +@@ -743,13 +743,14 @@ struct socket *tcp_listen(Slirp *slirp, uint32_t haddr, unsigned hport, + struct sockaddr_in addr; + struct socket *so; + int s, opt = 1; ++ char inet_addr[INET_ADDRSTRLEN]; + socklen_t addrlen = sizeof(addr); + memset(&addr, 0, addrlen); + + DEBUG_CALL("tcp_listen"); +- DEBUG_ARG("haddr = %s", inet_ntoa((struct in_addr){ .s_addr = haddr })); ++ DEBUG_ARG("haddr = %s", inet_ntop(AF_INET, &(struct in_addr){ .s_addr = haddr }, inet_addr, sizeof(inet_addr))); + DEBUG_ARG("hport = %d", ntohs(hport)); +- DEBUG_ARG("laddr = %s", inet_ntoa((struct in_addr){ .s_addr = laddr })); ++ DEBUG_ARG("laddr = %s", inet_ntop(AF_INET, &(struct in_addr){ .s_addr = laddr }, inet_addr, sizeof(inet_addr))); + DEBUG_ARG("lport = %d", ntohs(lport)); + DEBUG_ARG("flags = %x", flags); + diff --git a/src/udp.c b/src/udp.c index e4578aa94ed5..0547cd6fc5c3 100644 --- a/src/udp.c diff --git a/libslirp.spec b/libslirp.spec index d0e2a00..e5e5776 100644 --- a/libslirp.spec +++ b/libslirp.spec @@ -1,6 +1,6 @@ Name: libslirp Version: 4.4.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A general purpose TCP-IP emulator # check the SPDX tags in source files for details @@ -63,6 +63,10 @@ developing applications that use %{name}. %changelog +* Fri Feb 11 2022 Jindrich Novy - 4.4.0-7 +- fix also socket.c, thanks to Marc-André Lureau +- Related: #2000051 + * Fri Feb 11 2022 Jindrich Novy - 4.4.0-6 - add patches fixing gating tests from Marc-André Lureau - Related: #2000051