summaryrefslogtreecommitdiff
path: root/libavformat/http.c
diff options
context:
space:
mode:
authorAman Gupta <aman@tmm1.net>2017-12-29 15:25:14 -0800
committerAman Gupta <aman@tmm1.net>2017-12-30 09:58:03 -0800
commitc0b08ef94f037572876448990dca840b85432262 (patch)
treefb5f69c7e4f77e5871dfcfec216b92dee75ac3c5 /libavformat/http.c
parent51027d0b8b2835d4c70c9cb7b2ab5e28d5e3f22f (diff)
avformat/http: return EINVAL if ff_http_do_new_request is called with non-http URLContext
Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'libavformat/http.c')
-rw-r--r--libavformat/http.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/http.c b/libavformat/http.c
index a376f1a488..8f7e56de54 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -311,6 +311,11 @@ int ff_http_do_new_request(URLContext *h, const char *uri)
char hostname1[1024], hostname2[1024], proto1[10], proto2[10];
int port1, port2;
+ if (!h->prot ||
+ !(!strcmp(h->prot->name, "http") ||
+ !strcmp(h->prot->name, "https")))
+ return AVERROR(EINVAL);
+
av_url_split(proto1, sizeof(proto1), NULL, 0,
hostname1, sizeof(hostname1), &port1,
NULL, 0, s->location);