summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2016-12-20 12:19:25 +0000
committerChristos Zoulas <christos@zoulas.com>2016-12-20 12:19:25 +0000
commit61560793d7a9fc6ece2c28f9c4ed9a5b6b53a1a5 (patch)
treefd6e95d25777348e6f6205da50a9ccc31e9e5bd4
parentf132b8257100877dcabdcef10051adccbc33d6f9 (diff)
downloadfile-git-61560793d7a9fc6ece2c28f9c4ed9a5b6b53a1a5.tar.gz
when the pattern search length is 0, search for the empty string instead
of the original string because the original string might not be NUL-terminated. Found by oss-fuzzer.
-rw-r--r--src/softmagic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/softmagic.c b/src/softmagic.c
index 2543dfec..bfbbdc5c 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.239 2016/12/20 03:15:16 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.240 2016/12/20 12:19:25 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -1888,7 +1888,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
copy[--slen] = '\0';
search = copy;
} else {
- search = ms->search.s;
+ search = __UNCONST("");
copy = NULL;
}
rc = file_regexec(&rx, (const char *)search,