From 1dbdc4f37d01b646cb8452ed80c399b18a6af41e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 20 Apr 2013 21:31:35 +0200 Subject: [PATCH] sasl: Add missing length check This could otherwise lead to an integer underflow on specially crafted input. Signed-off-by: Uli Schlachter --- modules/sasl.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/sasl.cpp b/modules/sasl.cpp index 202d64d3..dfacd4c3 100644 --- a/modules/sasl.cpp +++ b/modules/sasl.cpp @@ -145,6 +145,11 @@ public: data += size; /* Server public key */ + if (length < 2) { + DEBUG("sasl: No public key"); + return false; + } + size = ntohs(*(uint16_t*)data); data += 2; length -= 2;