From d271ef9613fdb0ff41278713cf2d1506170ba43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Thu, 19 Aug 2021 21:47:16 +0200 Subject: [PATCH] Fixed 'stack-buffer-overflow' found by ASAN during SHA1 generation #3554 --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c00a189c7..3f95abb57 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1710,7 +1710,7 @@ int main(int argc, const char * argv[]) { SHA1(fb, statbuf.st_size, temp); binary_sha1 = (char *)malloc(SHA_DIGEST_LENGTH*2+1); memset(binary_sha1, 0, SHA_DIGEST_LENGTH*2+1); - char buf[SHA_DIGEST_LENGTH*2]; + char buf[SHA_DIGEST_LENGTH*2 + 1]; for (int i=0; i < SHA_DIGEST_LENGTH; i++) { sprintf((char*)&(buf[i*2]), "%02x", temp[i]); }