diff options
author | Christos Zoulas <christos@zoulas.com> | 2016-12-20 12:19:25 +0000 |
---|---|---|
committer | Christos Zoulas <christos@zoulas.com> | 2016-12-20 12:19:25 +0000 |
commit | 61560793d7a9fc6ece2c28f9c4ed9a5b6b53a1a5 (patch) | |
tree | fd6e95d25777348e6f6205da50a9ccc31e9e5bd4 | |
parent | f132b8257100877dcabdcef10051adccbc33d6f9 (diff) | |
download | file-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.c | 4 |
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, |