summaryrefslogtreecommitdiff
path: root/libavformat/rtmpproto.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-05-16 11:45:47 +0300
committerMartin Storsjö <martin@martin.st>2012-05-17 21:16:52 +0300
commit4b7304e80d5f4312e34a748e6c34eb6a7346af7b (patch)
tree76eaa3fa2d08d94f1f9cc1193a0cea1af5b329a5 /libavformat/rtmpproto.c
parent01e98b1b006c67ab0948f3c1de65a94609fe79cf (diff)
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: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r--libavformat/rtmpproto.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 427655c27e..1b86c44f00 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -895,9 +895,10 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
fname = path + 10;
memcpy(rt->app, "ondemand", 9);
} else {
- char *p = strchr(path + 1, '/');
+ char *next = *path ? path + 1 : path;
+ char *p = strchr(next, '/');
if (!p) {
- fname = path + 1;
+ fname = next;
rt->app[0] = '\0';
} else {
char *c = strchr(p + 1, ':');