void-packages/srcpkgs/pev/patches/0001-Fix-buffer-underwrite-...

27 lines
760 B
Diff

From d27d76f7a52c154f809847d2b7d30cab2d7d31ed Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@jwilk.net>
Date: Mon, 17 Jul 2017 12:10:31 +0200
Subject: [PATCH 01/12] Fix buffer underwrite in imphash()
---
src/pehash.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git src/pehash.c src/pehash.c
index e03a0a9..ffb4fdd 100644
--- src/pehash.c
+++ src/pehash.c
@@ -483,7 +483,8 @@ static void imphash(pe_ctx_t *ctx, int flavor)
free(elt);
imphash_string_size = strlen(imphash_string);
- imphash_string[imphash_string_size-1] = '\0'; // remove the last comma sign
+ if (imphash_string_size)
+ imphash_string[imphash_string_size-1] = '\0'; // remove the last comma sign
//puts(imphash_string); // DEBUG
--
2.26.2.672.g232c24e857