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
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 */