Do not segfault with badly formed URL

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2024-02-28 07:38:56 +10:00
parent 4a115b4dca
commit f343db5b8e

View file

@ -1114,7 +1114,7 @@ int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
STRDUP(payload->fileurl, url, FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, err));
c = strrchr(url, '/');
if(strstr(c, ".pkg")) {
if(c != NULL && strstr(c, ".pkg")) {
/* we probably have a usable package filename to download to */
payload->allow_resume = 1;
} else {