changeset 2092:16fb6263ff34

Add NULL check for search pattern memory allocation.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Sep 2019 14:03:18 +0300
parents 10d63f13abcb
children d4e4c7fadf31
files mapsearch.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mapsearch.c	Thu Sep 05 13:56:17 2019 +0300
+++ b/mapsearch.c	Thu Sep 05 14:03:18 2019 +0300
@@ -1194,7 +1194,11 @@
         goto out;
     }
 
-    pattern = th_strndup((char *) data + offs1, slen);
+    if ((pattern = th_strndup((char *) data + offs1, slen)) == NULL)
+    {
+        *verr = "Could not allocate search pattern memory.";
+        goto out;
+    }
 
     mapMSG(2, "Search pattern: '%s'\n", pattern);