From: Vsevolod Stakhov Date: Sat, 28 Mar 2026 09:14:15 +0000 (+0000) Subject: [Fix] Default map URL path to "/" when no path component is present X-Git-Tag: 4.0.0~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7b609847a07498df85ef9c70dc2ad4f97ab269f;p=thirdparty%2Frspamd.git [Fix] Default map URL path to "/" when no path component is present When an HTTP(S) map URL has no path (e.g. "https://maps.rspamd.com"), the URL parser leaves hdata->path as NULL. This causes a segfault in write_http_request() which calls strlen() on the NULL path pointer. Default path to "/" and rest to "" when UF_PATH is not set, matching standard HTTP semantics. Fixes: #5955 --- diff --git a/src/libserver/maps/map.c b/src/libserver/maps/map.c index 81062d9c76..c8d1c1e9b0 100644 --- a/src/libserver/maps/map.c +++ b/src/libserver/maps/map.c @@ -3337,6 +3337,11 @@ rspamd_map_parse_backend(struct rspamd_config *cfg, const char *map_line) hdata->rest = g_strdup(""); } } + else { + /* No path in URL (e.g. https://host), default to "/" */ + hdata->path = g_strdup("/"); + hdata->rest = g_strdup(""); + } if (up.field_set & (1u << UF_USERINFO)) { /* Create authorisation header for basic auth */