From cb94ffe1c06bff6d5e0d0f2f9e8f378283ef4300 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Fri, 17 Jun 2016 16:55:02 +0200 Subject: [PATCH] util_hash.c: fail on negative result code of read. --- lib/util_hash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/util_hash.c b/lib/util_hash.c index f13f1b0e..0e62d45e 100644 --- a/lib/util_hash.c +++ b/lib/util_hash.c @@ -125,6 +125,8 @@ xbps_file_hash_raw(const char *file) SHA256_Update(&sha256, buf, len); SHA256_Final(digest, &sha256); close(fd); + if(len < 0) + return NULL; return digest; }