changeset 721:c834e1393eb0

Initialize regex parsing context before checking pointers.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 Dec 2020 13:53:06 +0200
parents ff724f45162a
children 4ca6a3b30fe8
files th_regex.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/th_regex.c	Wed Nov 11 15:08:03 2020 +0200
+++ b/th_regex.c	Sun Dec 13 13:53:06 2020 +0200
@@ -457,6 +457,8 @@
     th_char_t *tmp = NULL;
     size_t start;
 
+    memset(&ctx, 0, sizeof(ctx));
+
     // Check pointers
     if (pexpr == NULL || pattern == NULL)
     {
@@ -465,7 +467,6 @@
     }
 
     // Initialize parsing context
-    memset(&ctx, 0, sizeof(ctx));
     ctx.pattern = pattern;
     ctx.bufSize = 256;