yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
255e5e
From 11fc63b5c59a02cd8ce2f5021c4c4ee6bbe88b57 Mon Sep 17 00:00:00 2001
255e5e
From: jmaloy <jmaloy@redhat.com>
255e5e
Date: Thu, 14 May 2020 21:13:13 +0100
255e5e
Subject: [PATCH 5/6] tcp_ctl: 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-6-jmaloy@redhat.com>
255e5e
Patchwork-id: 96589
255e5e
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 5/6] tcp_ctl: 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
Make it safer to OOB (sb_cc must not go out of sb_data), warn on
255e5e
truncation, abort on error.
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-6-marcandre.lureau@redhat.com>
255e5e
255e5e
(cherry picked from libslirp commit c8ee10e29c668a30a8d10e8a16c570b1bbe32175)
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/tcp_subr.c | 5 ++---
255e5e
 1 file changed, 2 insertions(+), 3 deletions(-)
255e5e
255e5e
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
255e5e
index ac14366..53aa58d 100644
255e5e
--- a/slirp/tcp_subr.c
255e5e
+++ b/slirp/tcp_subr.c
255e5e
@@ -984,9 +984,8 @@ int tcp_ctl(struct socket *so)
255e5e
             }
255e5e
         }
255e5e
     }
255e5e
-    sb->sb_cc =
255e5e
-        snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
255e5e
-                 "Error: No application configured.\r\n");
255e5e
+    sb->sb_cc = slirp_fmt(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
255e5e
+                          "Error: No application configured.\r\n");
255e5e
     sb->sb_wptr += sb->sb_cc;
255e5e
     return 0;
255e5e
 }
255e5e
-- 
255e5e
1.8.3.1
255e5e