diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-01-27 10:24:13 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-01-27 10:28:43 +0100 |
commit | c8ee10e29c668a30a8d10e8a16c570b1bbe32175 (patch) | |
tree | b85c4180dc761e034dc7629e577f4a28d2112d15 /src/tcp_subr.c | |
parent | 98968c4f94330b3e4fe48dc79a851eff5e8a5962 (diff) | |
download | slirp-c8ee10e29c668a30a8d10e8a16c570b1bbe32175.zip slirp-c8ee10e29c668a30a8d10e8a16c570b1bbe32175.tar.gz slirp-c8ee10e29c668a30a8d10e8a16c570b1bbe32175.tar.bz2 |
tcp_ctl: use slirp_fmt()
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>
Diffstat (limited to 'src/tcp_subr.c')
-rw-r--r-- | src/tcp_subr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/tcp_subr.c b/src/tcp_subr.c index 7832b14..a699117 100644 --- a/src/tcp_subr.c +++ b/src/tcp_subr.c @@ -965,9 +965,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; } |