yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
255e5e
From 07007a43513817859d0c0b50c21a96221aa101e4 Mon Sep 17 00:00:00 2001
255e5e
From: jmaloy <jmaloy@redhat.com>
255e5e
Date: Thu, 14 May 2020 21:13:10 +0100
255e5e
Subject: [PATCH 2/6] dhcpv6: use slirp_fmt()
255e5e
MIME-Version: 1.0
255e5e
Content-Type: text/plain; charset=UTF-8
255e5e
Content-Transfer-Encoding: 8bit
255e5e
255e5e
RH-Author: jmaloy <jmaloy@redhat.com>
255e5e
Message-id: <20200514211314.1534001-3-jmaloy@redhat.com>
255e5e
Patchwork-id: 96586
255e5e
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 2/6] dhcpv6: use slirp_fmt()
255e5e
Bugzilla: 1834477
255e5e
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
255e5e
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
255e5e
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
255e5e
255e5e
From: Marc-André Lureau <marcandre.lureau@redhat.com>
255e5e
255e5e
Warn if result is truncated, return bytes actually written (excluding \0).
255e5e
255e5e
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
255e5e
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
255e5e
Message-Id: <20200127092414.169796-3-marcandre.lureau@redhat.com>
255e5e
255e5e
(cherry picked from libslirp commit f207a7cee35a584d8ecd4b852cb238fb5d743c85)
255e5e
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
255e5e
255e5e
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
255e5e
---
255e5e
 slirp/dhcpv6.c | 13 ++++++-------
255e5e
 1 file changed, 6 insertions(+), 7 deletions(-)
255e5e
255e5e
diff --git a/slirp/dhcpv6.c b/slirp/dhcpv6.c
255e5e
index d266611..1ee6176 100644
255e5e
--- a/slirp/dhcpv6.c
255e5e
+++ b/slirp/dhcpv6.c
255e5e
@@ -162,13 +162,12 @@ static void dhcpv6_info_request(Slirp *slirp, struct sockaddr_in6 *srcsas,
255e5e
         *resp++ = OPTION_BOOTFILE_URL >> 8;     /* option-code high byte */
255e5e
         *resp++ = OPTION_BOOTFILE_URL;          /* option-code low byte */
255e5e
         smaxlen = (uint8_t *)m->m_data + IF_MTU - (resp + 2);
255e5e
-        slen = snprintf((char *)resp + 2, smaxlen,
255e5e
-                        "tftp://[%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
255e5e
-                                "%02x%02x:%02x%02x:%02x%02x:%02x%02x]/%s",
255e5e
-                        sa[0], sa[1], sa[2], sa[3], sa[4], sa[5], sa[6], sa[7],
255e5e
-                        sa[8], sa[9], sa[10], sa[11], sa[12], sa[13], sa[14],
255e5e
-                        sa[15], slirp->bootp_filename);
255e5e
-        slen = MIN(slen, smaxlen);
255e5e
+        slen = slirp_fmt((char *)resp + 2, smaxlen,
255e5e
+                         "tftp://[%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
255e5e
+                         "%02x%02x:%02x%02x:%02x%02x:%02x%02x]/%s",
255e5e
+                         sa[0], sa[1], sa[2], sa[3], sa[4], sa[5], sa[6], sa[7],
255e5e
+                         sa[8], sa[9], sa[10], sa[11], sa[12], sa[13], sa[14],
255e5e
+                         sa[15], slirp->bootp_filename);
255e5e
         *resp++ = slen >> 8;                    /* option-len high byte */
255e5e
         *resp++ = slen;                         /* option-len low byte */
255e5e
         resp += slen;
255e5e
-- 
255e5e
1.8.3.1
255e5e