From bf26a91d57516326016772e1b6a1455638678c09 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Thu, 6 Mar 2014 15:23:16 +0000 Subject: [PATCH] simplify 0 offset case --- src/softmagic.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/softmagic.c b/src/softmagic.c index 5ed3998e..0ef0c10a 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.177 2014/02/21 14:32:48 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.178 2014/03/04 17:42:19 christos Exp $") #endif /* lint */ #include "magic.h" @@ -538,8 +538,7 @@ mprint(struct magic_set *ms, struct magic *m) case FILE_LEDATE: case FILE_MEDATE: if (file_printf(ms, F(m->desc, "%s"), - file_fmttime(p->l, FILE_T_LOCAL, - tbuf)) == -1) + file_fmttime(p->l, FILE_T_LOCAL, tbuf)) == -1) return -1; t = ms->offset + sizeof(uint32_t); break; @@ -1740,14 +1739,14 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m, break; case FILE_REGEX: - if (OFFSET_OOB(nbytes, offset, 0)) + if (nbytes < offset) return 0; break; case FILE_INDIRECT: if (offset == 0) return 0; - if (OFFSET_OOB(nbytes, offset, 0)) + if (nbytes < offset) return 0; sbuf = ms->o.buf; soffset = ms->offset; @@ -1775,7 +1774,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m, return rv; case FILE_USE: - if (OFFSET_OOB(nbytes, offset, 0)) + if (nbytes < offset) return 0; sbuf = m->value.s; if (*sbuf == '^') { -- 2.40.0