diff --git a/src/microcode/regex.c b/src/microcode/regex.c index d2c46adf0..b9832eb48 100644 --- a/src/microcode/regex.c +++ b/src/microcode/regex.c @@ -138,21 +138,18 @@ USA. { \ if (stack_pointer == stack_end) \ { \ - long stack_length; \ - unsigned char **stack_temporary; \ - \ - stack_length = ((stack_end - stack_start) * 2); \ + unsigned long stack_length = ((stack_end - stack_start) * 2); \ if (stack_length > (re_max_failures * 2)) \ RE_RETURN (-4); \ - stack_temporary = \ + unsigned long stack_used = (stack_pointer - stack_start); \ + unsigned char ** stack_temporary = \ ((unsigned char **) \ (realloc \ (stack_start, (stack_length * (sizeof (unsigned char *)))))); \ if (stack_temporary == NULL) \ RE_RETURN (-3); \ stack_end = (& (stack_temporary [stack_length])); \ - stack_pointer = \ - (& (stack_temporary [(stack_pointer - stack_start)])); \ + stack_pointer = (& (stack_temporary [stack_used])); \ stack_start = stack_temporary; \ } \ (*stack_pointer++) = (pattern_pc); \