From 11fc63b5c59a02cd8ce2f5021c4c4ee6bbe88b57 Mon Sep 17 00:00:00 2001
From: jmaloy <jmaloy@redhat.com>
Date: Thu, 14 May 2020 21:13:13 +0100
Subject: [PATCH 5/6] tcp_ctl: use slirp_fmt()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: jmaloy <jmaloy@redhat.com>
Message-id: <20200514211314.1534001-6-jmaloy@redhat.com>
Patchwork-id: 96589
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 5/6] tcp_ctl: use slirp_fmt()
Bugzilla: 1834477
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Make it safer to OOB (sb_cc must not go out of sb_data), warn on
truncation, abort on error.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-Id: <20200127092414.169796-6-marcandre.lureau@redhat.com>
(cherry picked from libslirp commit c8ee10e29c668a30a8d10e8a16c570b1bbe32175)
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
slirp/tcp_subr.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index ac14366..53aa58d 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -984,9 +984,8 @@ int tcp_ctl(struct socket *so)
}
}
}
- sb->sb_cc =
- snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
- "Error: No application configured.\r\n");
+ sb->sb_cc = slirp_fmt(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
+ "Error: No application configured.\r\n");
sb->sb_wptr += sb->sb_cc;
return 0;
}
--
1.8.3.1