Skip to content

Commit

Permalink
HttpAuthentication: Check LockBuffer() success...
Browse files Browse the repository at this point in the history
... in _H() MD5 digest method. Thanks to axeld
for the suggestion.
  • Loading branch information
stippi committed Jun 5, 2014
1 parent f0e21af commit 16b8886
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/kits/network/libnetapi/HttpAuthentication.cpp
Expand Up @@ -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';
Expand Down

0 comments on commit 16b8886

Please sign in to comment.