diff options
author | Renato Botelho <renato@netgate.com> | 2016-07-11 14:09:23 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-07-11 14:09:23 -0300 |
commit | 3a4027cfafa37c1a0c0b05987c0edb1452c7bd2b (patch) | |
tree | 66dc775beb72a91e58e26949f9cba8fbd74c9301 /contrib/file/src/softmagic.c | |
parent | ac9e13a9f38640234319dfe1b3c26b7e69057982 (diff) | |
parent | 0ddba37c51521e5d2e7ada2ebd4619a703477036 (diff) | |
download | FreeBSD-src-3a4027cfafa37c1a0c0b05987c0edb1452c7bd2b.zip FreeBSD-src-3a4027cfafa37c1a0c0b05987c0edb1452c7bd2b.tar.gz |
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'contrib/file/src/softmagic.c')
-rw-r--r-- | contrib/file/src/softmagic.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/file/src/softmagic.c b/contrib/file/src/softmagic.c index 2ceb26c..644c9d9 100644 --- a/contrib/file/src/softmagic.c +++ b/contrib/file/src/softmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.231 2016/04/21 15:23:31 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.234 2016/06/13 12:02:06 christos Exp $") #endif /* lint */ #include "magic.h" @@ -827,6 +827,7 @@ moffset(struct magic_set *ms, struct magic *m, size_t nbytes, int32_t *op) "Bad DER offset %d nbytes=%zu", o, nbytes); } + *op = 0; return 0; } break; @@ -1181,6 +1182,8 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, switch (type) { case FILE_DER: case FILE_SEARCH: + if (offset > nbytes) + offset = nbytes; ms->search.s = RCAST(const char *, s) + offset; ms->search.s_len = nbytes - offset; ms->search.offset = offset; @@ -2077,6 +2080,7 @@ magiccheck(struct magic_set *ms, struct magic *m) if (slen != 0) { copy = malloc(slen); if (copy == NULL) { + file_regfree(&rx); file_error(ms, errno, "can't allocate %" SIZE_T_FORMAT "u bytes", slen); |