Commit 4b7304e8 authored by Martin Storsjö's avatar Martin Storsjö

rtmp: Don't assume path points to a string of nonzero length

If using the new -rtmp_app and -rtmp_playpath parameters,
one can in many cases set the main url to just rtmp://server/.
If the trailing slash is omitted, path is a string of zero length,
and using path+1 will end up reading uninitialized data.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 01e98b1b
...@@ -895,9 +895,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) ...@@ -895,9 +895,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
fname = path + 10; fname = path + 10;
memcpy(rt->app, "ondemand", 9); memcpy(rt->app, "ondemand", 9);
} else { } else {
char *p = strchr(path + 1, '/'); char *next = *path ? path + 1 : path;
char *p = strchr(next, '/');
if (!p) { if (!p) {
fname = path + 1; fname = next;
rt->app[0] = '\0'; rt->app[0] = '\0';
} else { } else {
char *c = strchr(p + 1, ':'); char *c = strchr(p + 1, ':');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment