Skip to content

Commit

Permalink
[Minor] Add null safety to rspamd_regexp_new
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Aug 15, 2020
1 parent 0a73720 commit e2abe33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libutil/regexp.c
Expand Up @@ -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 == '/') {
Expand Down

0 comments on commit e2abe33

Please sign in to comment.