From 16b8886a598b35fd4dc6539f5086edc3dd07c9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 5 Jun 2014 21:42:20 +0200 Subject: [PATCH] HttpAuthentication: Check LockBuffer() success... ... in _H() MD5 digest method. Thanks to axeld for the suggestion. --- src/kits/network/libnetapi/HttpAuthentication.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kits/network/libnetapi/HttpAuthentication.cpp b/src/kits/network/libnetapi/HttpAuthentication.cpp index f5df650865..e6840c771c 100644 --- a/src/kits/network/libnetapi/HttpAuthentication.cpp +++ b/src/kits/network/libnetapi/HttpAuthentication.cpp @@ -381,6 +381,9 @@ BHttpAuthentication::_H(const BString& value) const BString result; // Preallocate the string char* resultChar = result.LockBuffer(MD5_DIGEST_LENGTH * 2); + if (resultChar == NULL) + return BString(); + for (int i = 0; i < MD5_DIGEST_LENGTH; i++) { char c = ((hashResult[i] & 0xF0) >> 4); c += (c > 9) ? 'a' - 10 : '0';