Skip to content

Commit 39c7ac1

Browse files
committed
Fix note bounds reading, Francisco Alonso / Red Hat
1 parent 964bf04 commit 39c7ac1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Diff for: ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2014-10-17 11:48 Christos Zoulas <christos@zoulas.com>
2+
3+
* fix bounds in note reading (Francisco Alonso / Red Hat)
4+
15
2014-10-11 15:02 Christos Zoulas <christos@zoulas.com>
26

37
* fix autoconf glue for setlocale and locale_t; some OS's

Diff for: src/readelf.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "file.h"
2828

2929
#ifndef lint
30-
FILE_RCSID("@(#)$File: readelf.c,v 1.102 2014/03/11 21:00:13 christos Exp $")
30+
FILE_RCSID("@(#)$File: readelf.c,v 1.103 2014/05/02 02:25:10 christos Exp $")
3131
#endif
3232

3333
#ifdef BUILTIN_ELF
@@ -477,6 +477,13 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
477477
uint32_t namesz, descsz;
478478
unsigned char *nbuf = CAST(unsigned char *, vbuf);
479479

480+
if (xnh_sizeof + offset > size) {
481+
/*
482+
* We're out of note headers.
483+
*/
484+
return xnh_sizeof + offset;
485+
}
486+
480487
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
481488
offset += xnh_sizeof;
482489

0 commit comments

Comments
 (0)