[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULLv2 03/12] slirp: check sscanf result when emulating id
From: |
Samuel Thibault |
Subject: |
[Qemu-devel] [PULLv2 03/12] slirp: check sscanf result when emulating ident |
Date: |
Thu, 7 Mar 2019 12:51:34 +0100 |
From: William Bowling <address@hidden>
When emulating ident in tcp_emu, if the strchr checks passed but the
sscanf check failed, two uninitialized variables would be copied and
sent in the reply, so move this code inside the if(sscanf()) clause.
Signed-off-by: William Bowling <address@hidden>
Cc: address@hidden
Cc: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Samuel Thibault <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
slirp/tcp_subr.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 262a42d6c8..ef9d99c154 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -664,12 +664,12 @@ tcp_emu(struct socket *so, struct mbuf *m)
break;
}
}
+ so_rcv->sb_cc =
snprintf(so_rcv->sb_data,
+
so_rcv->sb_datalen,
+ "%d,%d\r\n",
n1, n2);
+ so_rcv->sb_rptr = so_rcv->sb_data;
+ so_rcv->sb_wptr = so_rcv->sb_data +
so_rcv->sb_cc;
}
- so_rcv->sb_cc = snprintf(so_rcv->sb_data,
- so_rcv->sb_datalen,
- "%d,%d\r\n", n1, n2);
- so_rcv->sb_rptr = so_rcv->sb_data;
- so_rcv->sb_wptr = so_rcv->sb_data +
so_rcv->sb_cc;
}
m_free(m);
return 0;
--
2.20.1
- [Qemu-devel] [PULLv2 00/12] slirp updates, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 02/12] slirp: check for ioctlsocket error and 0-length udp payload., Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 03/12] slirp: check sscanf result when emulating ident,
Samuel Thibault <=
- [Qemu-devel] [PULLv2 05/12] slirp: Mark pieces missing IPv6 support, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 08/12] slirp: use "slirp_" prefix for inet_aton() win32 implementation, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 04/12] slirp: fix big/little endian conversion in ident protocol, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 01/12] slirp: Fix build with gcc 9, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 07/12] slirp: use libslirp migration code, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 1/1] slirp: remove QEMU Makefile.objs, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 12/12] slirp: remove QEMU Makefile.objs, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 09/12] slirp: move sources to src/ subdirectory, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 10/12] slirp: add a standalone Makefile, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 11/12] build-sys: link with slirp as an external project, Samuel Thibault, 2019/03/07