...
|
...
|
@@ -169,23 +169,28 @@ static inline int matcher_run(const struct cli_matcher *root,
|
169
|
169
|
#if HAVE_PCRE
|
170
|
170
|
if (root->pcre_metas) {
|
171
|
171
|
if (map) {
|
172
|
|
- cli_dbgmsg("matcher_run: performing regex matching on full map: %u+%u(%u) >= %zu\n", offset, length, offset+length, map->len);
|
|
172
|
+ if (offset+length >= map->len) {
|
|
173
|
+ cli_dbgmsg("matcher_run: performing regex matching on full map: %u+%u(%u) >= %zu\n", offset, length, offset+length, map->len);
|
173
|
174
|
|
174
|
|
- buffer = fmap_need_off_once(map, 0, map->len);
|
175
|
|
- if (!buffer)
|
176
|
|
- return CL_EMEM;
|
|
175
|
+ buffer = fmap_need_off_once(map, 0, map->len);
|
|
176
|
+ if (!buffer)
|
|
177
|
+ return CL_EMEM;
|
177
|
178
|
|
178
|
|
- length = (uint32_t)(map->len);
|
|
179
|
+ /* scan the full buffer */
|
|
180
|
+ tmp = cli_pcre_scanbuf(buffer, map->len, root, mdata, acres, poffdata, ctx);
|
|
181
|
+ if((tmp == CL_VIRUS && !SCAN_ALL) || tmp == CL_EMEM) {
|
|
182
|
+ return tmp;
|
|
183
|
+ }
|
|
184
|
+ }
|
179
|
185
|
}
|
180
|
186
|
else {
|
181
|
187
|
cli_dbgmsg("matcher_run: performing regex matching on buffer with no map: %u+%u(%u)\n", offset, length, offset+length);
|
|
188
|
+ /* scan the specified buffer */
|
|
189
|
+ tmp = cli_pcre_scanbuf(buffer, length, root, mdata, acres, poffdata, ctx);
|
|
190
|
+ if((tmp == CL_VIRUS && !SCAN_ALL) || tmp == CL_EMEM) {
|
|
191
|
+ return tmp;
|
|
192
|
+ }
|
182
|
193
|
}
|
183
|
|
-
|
184
|
|
- /* scan the full buffer; use tmp because ret may have filetype data */
|
185
|
|
- tmp = cli_pcre_scanbuf(buffer, length, root, mdata, acres, poffdata, ctx);
|
186
|
|
- if((tmp == CL_VIRUS && !SCAN_ALL) || tmp == CL_EMEM) {
|
187
|
|
- return tmp;
|
188
|
|
- }
|
189
|
194
|
}
|
190
|
195
|
#endif /* HAVE_PCRE */
|
191
|
196
|
/* end experimental fragment */
|