commit 0d89d51: [Minor] Add a simple check when trying to parse urls on config stage

Vsevolod Stakhov vsevolod at rspamd.com
Sat Nov 12 21:56:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-12 15:53:29 +0000
URL: https://github.com/rspamd/rspamd/commit/0d89d51e9f280b36554e8f9bc66217e1d6f845c4 (HEAD -> master)

[Minor] Add a simple check when trying to parse urls on config stage

---
 src/libserver/url.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libserver/url.c b/src/libserver/url.c
index 8378c1637..932cd9e85 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -3627,6 +3627,15 @@ rspamd_url_find_single (rspamd_mempool_t *pool,
 		inlen = strlen (in);
 	}
 
+	/*
+	 * We might have a situation when we need to parse URLs on config file
+	 * parsing, but there is no valid url_scanner loaded. Hence, we just load
+	 * some defaults and it should be fine...
+	 */
+	if (url_scanner == NULL) {
+		rspamd_url_init (NULL);
+	}
+
 	memset (&cb, 0, sizeof (cb));
 	cb.begin = in;
 	cb.end = in + inlen;


More information about the Commits mailing list