From d522a891d2723df229705df4eb1113fa4753cade Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Fri, 25 Sep 2015 10:11:04 +0200 Subject: [PATCH] Fix potential stack overflow --- libyara/scan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libyara/scan.c b/libyara/scan.c index ac1f18b10e..9d6787f7a6 100644 --- a/libyara/scan.c +++ b/libyara/scan.c @@ -293,6 +293,9 @@ int _yr_scan_fast_hex_re_exec( // // The opcode following the ANY is located at ip + 4 + if (sp >= MAX_FAST_HEX_RE_STACK) + return -4; + code_stack[sp] = ip + 4; input_stack[sp] = current_input; matches_stack[sp] = matches;