#else
#include <unistd.h>
#endif
-#ifdef HAVE_STDDEF_H
-#include <stddef.h>
-#endif
#include <string.h>
#include <assert.h>
#include <ctype.h>
for (i = 0; i < MAGIC_SETS; i++) {
if (add_mlist(ms->mlist[i], map, i) == -1) {
file_oomem(ms, sizeof(*ml));
- goto fail;
+ apprentice_unmap(map);
+ return -1;
}
}
}
}
return 0;
-fail:
- for (i = 0; i < MAGIC_SETS; i++) {
- mlist_free(ms->mlist[i]);
- ms->mlist[i] = NULL;
- }
- return -1;
}
protected void
return 0;
}
- linecnt = m->str_range;
- bytecnt = linecnt * 80;
+ if (m->str_flags & REGEX_LINE_COUNT) {
+ linecnt = m->str_range;
+ bytecnt = linecnt * 80;
+ } else {
+ linecnt = 0;
+ bytecnt = m->str_range;
+ }
/* XXX bytecnt_max is to be kept for PHP, see cve-2014-3538.
PCRE might stuck if the input buffer is too big. To ensure
break;
default:
- matched = 0;
file_magerror(ms, "cannot happen with float: invalid relation `%c'",
m->reln);
return -1;
break;
default:
- matched = 0;
file_magerror(ms, "cannot happen with double: invalid relation `%c'", m->reln);
return -1;
}
break;
default:
- matched = 0;
file_magerror(ms, "cannot happen: invalid relation `%c'",
m->reln);
return -1;