Skip to content
Permalink
Browse files Browse the repository at this point in the history
Avoid OOB read (found by ASAN reported by F. Alonso)
  • Loading branch information
zoulasc committed Jan 2, 2019
1 parent 580927e commit 2858eaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/readelf.c
Expand Up @@ -27,7 +27,7 @@
#include "file.h"

#ifndef lint
FILE_RCSID("@(#)$File: readelf.c,v 1.156 2018/10/19 00:33:04 christos Exp $")
FILE_RCSID("@(#)$File: readelf.c,v 1.157 2019/01/02 19:44:14 christos Exp $")
#endif

#ifdef BUILTIN_ELF
Expand Down Expand Up @@ -752,7 +752,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)",
Expand Down

0 comments on commit 2858eaf

Please sign in to comment.