void-packages/srcpkgs/pev/patches/0004-Fix-imphash_string-buffer-size-calculation.patch
Đoàn Trần Công Danh c289bc2767 pev: fix crash with -D_FORTIFY_SOURCE=2
While we're at it, correct plugins dir, license, and fix musl build.

Fix: #22604
2020-06-08 07:42:37 +02:00

27 lines
861 B
Diff

From 180db22b5b51ef2a00eae9a25ca94d859d348a93 Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@jwilk.net>
Date: Mon, 17 Jul 2017 14:10:42 +0200
Subject: [PATCH 04/12] Fix imphash_string buffer size calculation
Fixes buffer overflow in imphash().
---
src/pehash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git src/pehash.c src/pehash.c
index 59e15b0..db1735a 100644
--- src/pehash.c
+++ src/pehash.c
@@ -470,7 +470,7 @@ static void imphash(pe_ctx_t *ctx, int flavor)
LL_COUNT(head, elt, count);
//printf("%d number of elements in list outside\n", count);
- size_t imphash_string_size = sizeof(char) * count * MAX_DLL_NAME + MAX_FUNCTION_NAME;
+ size_t imphash_string_size = sizeof(char) * count * (MAX_DLL_NAME + MAX_FUNCTION_NAME) + 1;
char *imphash_string = (char *) malloc_s(imphash_string_size);
--
2.26.2.672.g232c24e857