]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add null safety to rspamd_regexp_new
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 15 Aug 2020 13:53:54 +0000 (14:53 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 15 Aug 2020 13:53:54 +0000 (14:53 +0100)
src/libutil/regexp.c

index ce764a893861f370dc29be1d809a7373917da8ea..93b8125e49748d02f4675f331a9eecda08c878f8 100644 (file)
@@ -325,6 +325,12 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags,
 
        rspamd_regexp_library_init (NULL);
 
+       if (pattern == NULL) {
+               g_set_error (err, rspamd_regexp_quark(), EINVAL,
+                               "cannot create regexp from a NULL pattern");
+               return NULL;
+       }
+
        if (flags == NULL) {
                /* We need to parse pattern and detect flags set */
                if (*start == '/') {