diff options
author | delphij <delphij@FreeBSD.org> | 2015-09-04 05:56:14 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-09-04 05:56:14 +0000 |
commit | b4f95287e7ad4605d8433474cac175e666872738 (patch) | |
tree | a6555530784a0ffabc28788886b7eb36120d55b6 /contrib/file/src | |
parent | 3b2b2a3028e51228d9d73a19a40a90625f8d9882 (diff) | |
download | FreeBSD-src-b4f95287e7ad4605d8433474cac175e666872738.zip FreeBSD-src-b4f95287e7ad4605d8433474cac175e666872738.tar.gz |
MFV r287451 + 287452: file 5.24 + fix for bin/181436.
PR: 181436
MFC after: 2 weeks
Diffstat (limited to 'contrib/file/src')
-rw-r--r-- | contrib/file/src/file.c | 2 | ||||
-rw-r--r-- | contrib/file/src/funcs.c | 6 | ||||
-rw-r--r-- | contrib/file/src/readelf.c | 11 |
3 files changed, 15 insertions, 4 deletions
diff --git a/contrib/file/src/file.c b/contrib/file/src/file.c index c700f66..44f4cce 100644 --- a/contrib/file/src/file.c +++ b/contrib/file/src/file.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: file.c,v 1.164 2015/06/03 18:21:24 christos Exp $") +FILE_RCSID("@(#)$File: file.c,v 1.165 2015/06/11 12:52:32 christos Exp $") #endif /* lint */ #include "magic.h" diff --git a/contrib/file/src/funcs.c b/contrib/file/src/funcs.c index dc7bbd1..16f2c4e 100644 --- a/contrib/file/src/funcs.c +++ b/contrib/file/src/funcs.c @@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.82 2015/06/03 18:01:20 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.83 2015/06/16 14:17:37 christos Exp $") #endif /* lint */ #include "magic.h" @@ -107,8 +107,10 @@ file_error_core(struct magic_set *ms, int error, const char *f, va_list va, if (lineno != 0) { free(ms->o.buf); ms->o.buf = NULL; - file_printf(ms, "line %" SIZE_T_FORMAT "u: ", lineno); + file_printf(ms, "line %" SIZE_T_FORMAT "u:", lineno); } + if (ms->o.buf && *ms->o.buf) + file_printf(ms, " "); file_vprintf(ms, f, va); if (error > 0) file_printf(ms, " (%s)", strerror(error)); diff --git a/contrib/file/src/readelf.c b/contrib/file/src/readelf.c index 55009e8..bc6e7f6 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.119 2015/04/09 20:01:41 christos Exp $") +FILE_RCSID("@(#)$File: readelf.c,v 1.120 2015/06/16 14:18:07 christos Exp $") #endif #ifdef BUILTIN_ELF @@ -1048,9 +1048,18 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, break; } + /* Things we can determine when we seek */ switch (xsh_type) { case SHT_NOTE: + if (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) + return -1; + return 0; + } if ((nbuf = malloc(xsh_size)) == NULL) { file_error(ms, errno, "Cannot allocate memory" " for note"); |