From 6c8dbaa97671ea937bcc5e18a39dffca0d691b3d Mon Sep 17 00:00:00 2001 From: xfarrow <49845537+xfarrow@users.noreply.github.com> Date: Wed, 19 Apr 2023 11:54:00 +0200 Subject: [PATCH] Bugfix SHA-1 hash comparison --- dircomp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dircomp.c b/dircomp.c index 63412a6..c22000e 100644 --- a/dircomp.c +++ b/dircomp.c @@ -325,7 +325,7 @@ int hash_by_hash_file_comparison(char* filename1, char* filename2) { char* hash1 = sha1(filename1); char* hash2 = sha1(filename2); - int ret = (strcmp(hash1, hash2) == 0); + int ret = (memcmp(hash1, hash2, SHA_DIGEST_LENGTH) == 0); free(hash1); free(hash2); return ret;