[vlc-devel] [PATCH 1/2] HTTP: fix possible crash in vlc_http_res_get_redirect

Jean-Baptiste Kempf jb at videolan.org
Wed Sep 6 01:08:29 CEST 2017


If vlc_uri_resolve returns NULL, then strcspn will crash
---
 modules/access/http/resource.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules/access/http/resource.c b/modules/access/http/resource.c
index ca55b49375..cc55ec5310 100644
--- a/modules/access/http/resource.c
+++ b/modules/access/http/resource.c
@@ -298,6 +298,9 @@ char *vlc_http_res_get_redirect(struct vlc_http_resource *restrict res)
     free(fixed);
     free(base);
 
+    if (unlikely(abs == NULL))
+        return NULL;
+
     /* NOTE: The anchor is discarded if it is present as VLC does not support
      * HTML anchors so far. */
     size_t len = strcspn(abs, "#");
-- 
2.14.1



More information about the vlc-devel mailing list