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