[vlc-commits] HTTP: fix possible crash in vlc_http_res_get_redirect
Jean-Baptiste Kempf
git at videolan.org
Wed Sep 6 14:48:59 CEST 2017
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Sep 5 23:41:25 2017 +0200| [fd168dd49a6875993cd78da0e51f50256e10f683] | committer: Jean-Baptiste Kempf
HTTP: fix possible crash in vlc_http_res_get_redirect
If vlc_uri_resolve returns NULL, then strcspn will crash
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fd168dd49a6875993cd78da0e51f50256e10f683
---
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;
}
More information about the vlc-commits
mailing list