Subject: remove over-zealous, and fix test properly Origin: FILE5_25-6-gb72c33f Upstream-Author: Christos Zoulas Date: Wed Sep 16 22:37:05 2015 +0000 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -1098,12 +1098,6 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m) { - if (offset >= nbytes) { - file_magerror(ms, - "offset in magic %u greater than buffer size %zu", - offset, nbytes); - return -1; - } /* * Note: FILE_SEARCH and FILE_REGEX do not actually copy * anything, but setup pointers into the source @@ -1268,7 +1262,7 @@ if (m->in_op & FILE_OPINDIRECT) { const union VALUETYPE *q = CAST(const union VALUETYPE *, ((const void *)(s + offset + off))); - if (OFFSET_OOB(offset + off, nbytes, sizeof(*q))) + if (OFFSET_OOB(nbytes, offset + off, sizeof(*q))) return 0; switch (cvt_flip(m->in_type, flip)) { case FILE_BYTE: @@ -2166,7 +2160,6 @@ private int handle_annotation(struct magic_set *ms, struct magic *m) { -printf("desc = %s, ext = %s mime = %s\n", m->desc, m->ext, m->mimetype); if (ms->flags & MAGIC_APPLE) { if (file_printf(ms, "%.8s", m->apple) == -1) return -1;