commit e2abe33: [Minor] Add null safety to rspamd_regexp_new
Vsevolod Stakhov
vsevolod at highsecure.ru
Sat Aug 15 13:56:14 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-08-15 14:53:54 +0100
URL: https://github.com/rspamd/rspamd/commit/e2abe3362a932d9fa3335b2f935496bd19d1cc12 (HEAD -> master)
[Minor] Add null safety to rspamd_regexp_new
---
src/libutil/regexp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index ce764a893..93b8125e4 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -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 == '/') {
More information about the Commits
mailing list