From 9242121dcae43a736a9de5cf73c48a6dc95516f8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Oct 2013 14:17:49 +0200 Subject: CVE-2013-4408:s3:util_tsock: add some overflow detection to tstream_read_packet_done() Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- source3/lib/util_tsock.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source3/lib/util_tsock.c b/source3/lib/util_tsock.c index 35a97f5e692..03380ef244b 100644 --- a/source3/lib/util_tsock.c +++ b/source3/lib/util_tsock.c @@ -110,6 +110,11 @@ static void tstream_read_packet_done(struct tevent_req *subreq) return; } + if (total + more < total) { + tevent_req_error(req, EMSGSIZE); + return; + } + tmp = talloc_realloc(state, state->buf, uint8_t, total+more); if (tevent_req_nomem(tmp, req)) { return; -- cgit v1.2.1