CVE-2019-8906.patch 506 Bytes
Newer Older
Leo's avatar
Leo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
diff --git a/src/readelf.c b/src/readelf.c
index 5f425c9..50883fe 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -720,7 +720,7 @@ do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,
 			char sbuf[512];
 			struct NetBSD_elfcore_procinfo pi;
 			memset(&pi, 0, sizeof(pi));
-			memcpy(&pi, nbuf + doff, descsz);
+			memcpy(&pi, nbuf + doff, MIN(descsz, sizeof(pi)));
 
 			if (file_printf(ms, ", from '%.31s', pid=%u, uid=%u, "
 			    "gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)",