From 29bd4d126a1fef4814bccd68eb65cba5fb9e427c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 16 Oct 2013 14:17:49 +0200 Subject: [PATCH] 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; -- 2.11.4.GIT