From fd168dd49a6875993cd78da0e51f50256e10f683 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Tue, 5 Sep 2017 23:41:25 +0200 Subject: [PATCH] HTTP: fix possible crash in vlc_http_res_get_redirect If vlc_uri_resolve returns NULL, then strcspn will crash --- modules/access/http/resource.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c index ca55b49375..dcaa0803b5 100644 --- a/modules/access/http/resource.c +++ b/modules/access/http/resource.c @@ -298,10 +298,13 @@ char *vlc_http_res_get_redirect(struct vlc_http_resource *restrict res) free(fixed); free(base); - /* NOTE: The anchor is discarded if it is present as VLC does not support - * HTML anchors so far. */ - size_t len = strcspn(abs, "#"); - abs[len] = '\0'; + if (likely(abs != NULL)) + { + /* NOTE: The anchor is discarded if it is present as VLC does not support + * HTML anchors so far. */ + size_t len = strcspn(abs, "#"); + abs[len] = '\0'; + } return abs; } -- 2.11.4.GIT