Fixed buffer overflow in Utils::Md5::hexdigest()

Found via failed test (auditlog.json) on Alpine Linux 3.8.2.
This commit is contained in:
Andrei Belov 2019-01-14 09:04:45 +03:00 committed by Felipe Zimmerle
parent 3c1fba278c
commit ae02076340
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -13,7 +13,7 @@ std::string Md5::hexdigest(std::string& input) {
mbedtls_md5(reinterpret_cast<const unsigned char *>(input.c_str()),
input.size(), digest);
char buf[32];
char buf[33];
for (int i = 0; i < 16; i++) {
sprintf(buf+i*2, "%02x", digest[i]);
}