summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-21 12:11:37 +0100
committerwm4 <wm4@nowhere>2015-01-21 12:11:37 +0100
commit303924c343778f15d80be7b61dc4c927b91eafd9 (patch)
treeaf052ae9db97949d73e217bd27b7ef99660af4eb
parentd558accaa69af1a0dcce0997f6343b4bc1e3f91d (diff)
downloadmpv-303924c343778f15d80be7b61dc4c927b91eafd9.tar.bz2
mpv-303924c343778f15d80be7b61dc4c927b91eafd9.tar.xz
stream: reject overly long URLs
-rw-r--r--stream/stream.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 1e1c5eee4e..4759a01abe 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <strings.h>
@@ -348,6 +349,9 @@ struct stream *stream_create(const char *url, int flags,
struct stream *s = NULL;
assert(url);
+ if (strlen(url) > INT_MAX / 8)
+ goto done;
+
// Open stream proper
bool unsafe = false;
for (int i = 0; stream_list[i]; i++) {