You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
989 B

diff --git a/src/softmagic.c b/src/softmagic.c
index 8d08cad..6dc86f5 100644
--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -41,8 +41,6 @@ FILE_RCSID("@(#)$File: softmagic.c,v 1.147 2011/11/05 15:44:22 rrt Exp $")
#include <stdlib.h>
#include <time.h>
-#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) >= ((n) - (o)))
-
private int match(struct magic_set *, struct magic *, uint32_t,
const unsigned char *, size_t, int, int, int);
private int mget(struct magic_set *, const unsigned char *,
@@ -1601,7 +1599,7 @@ mget(struct magic_set *ms, const unsigned char *s,
break;
case FILE_REGEX:
- if (OFFSET_OOB(nbytes, offset, 0))
+ if (nbytes < offset)
return 0;
break;
@@ -1611,7 +1609,7 @@ mget(struct magic_set *ms, const unsigned char *s,
return -1;
if (offset == 0)
return 0;
- if (OFFSET_OOB(nbytes, offset, 0))
+ if (nbytes < offset)
return 0;
return file_softmagic(ms, s + offset, nbytes - offset,
recursion_level, BINTEST, text);