From dae0b385cf030980cbc35812bf6cbd0ea8eca240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 22 Jan 2014 17:33:27 +0100 Subject: [PATCH] DataRequest: Don't leak buffer in error case. CID 1162796 --- src/kits/network/libnetapi/DataRequest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kits/network/libnetapi/DataRequest.cpp b/src/kits/network/libnetapi/DataRequest.cpp index 8da5fcc95a..b2fd9002a3 100644 --- a/src/kits/network/libnetapi/DataRequest.cpp +++ b/src/kits/network/libnetapi/DataRequest.cpp @@ -90,8 +90,11 @@ BDataRequest::_ProtocolLoop() // There may be some padding at the end of the base64 stream. This // prevents us from computing the exact length we should get, so allow // for some error margin. - if(length > data.Length() * 4 / 3 || length < data.Length() * 4 / 3 - 3) + if(length > data.Length() * 4 / 3 + || length < data.Length() * 4 / 3 - 3) { + delete[] buffer; return B_BAD_DATA; + } } else { payload = data.String(); length = data.Length();