diff options
author | delphij <delphij@FreeBSD.org> | 2015-09-23 05:39:20 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-09-23 05:39:20 +0000 |
commit | 34650d7da670a6653a5b0546b0656d1772779fd2 (patch) | |
tree | 51b0c2244d6415b10dbcb163aadb1f002f700e14 /contrib/file/src/readelf.c | |
parent | 3ef25e9daf8ff42f2a3c7781707a03823ff8eae6 (diff) | |
download | FreeBSD-src-34650d7da670a6653a5b0546b0656d1772779fd2.zip FreeBSD-src-34650d7da670a6653a5b0546b0656d1772779fd2.tar.gz |
MFV r288140: update file to 5.25.
MFC after: 1 month
Diffstat (limited to 'contrib/file/src/readelf.c')
-rw-r--r-- | contrib/file/src/readelf.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/file/src/readelf.c b/contrib/file/src/readelf.c index 9631591..2a7fc01 100644 --- a/contrib/file/src/readelf.c +++ b/contrib/file/src/readelf.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: readelf.c,v 1.120 2015/06/16 14:18:07 christos Exp $") +FILE_RCSID("@(#)$File: readelf.c,v 1.122 2015/09/10 13:59:32 christos Exp $") #endif #ifdef BUILTIN_ELF @@ -1052,11 +1052,14 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, /* Things we can determine when we seek */ switch (xsh_type) { case SHT_NOTE: - if (xsh_size + (uintmax_t)xsh_offset > (uintmax_t)fsize) { + if ((uintmax_t)(xsh_size + xsh_offset) > + (uintmax_t)fsize) { if (file_printf(ms, - ", note offset/size 0x%jx+0x%jx exceeds" - " file size 0x%jx", (uintmax_t)xsh_offset, - (uintmax_t)xsh_size, (uintmax_t)fsize) == -1) + ", note offset/size 0x%" INTMAX_T_FORMAT + "x+0x%" INTMAX_T_FORMAT "x exceeds" + " file size 0x%" INTMAX_T_FORMAT "x", + (uintmax_t)xsh_offset, (uintmax_t)xsh_size, + (uintmax_t)fsize) == -1) return -1; return 0; } @@ -1065,7 +1068,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, " for note"); return -1; } - if (pread(fd, nbuf, xsh_size, xsh_offset) < (ssize_t)xsh_size) { + if (pread(fd, nbuf, xsh_size, xsh_offset) < + (ssize_t)xsh_size) { file_badread(ms); free(nbuf); return -1; |