Commit 0a9a2257 authored by Samuel Pitoiset's avatar Samuel Pitoiset Committed by Martin Storsjö
Browse files

rtmp: Fix a possible access to invalid memory location when the playpath is too short.


Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent f862537d
...@@ -1141,11 +1141,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) ...@@ -1141,11 +1141,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
goto fail; goto fail;
} }
if (!strchr(fname, ':') && if (!strchr(fname, ':') && len >= 4 &&
(!strcmp(fname + len - 4, ".f4v") || (!strcmp(fname + len - 4, ".f4v") ||
!strcmp(fname + len - 4, ".mp4"))) { !strcmp(fname + len - 4, ".mp4"))) {
memcpy(rt->playpath, "mp4:", 5); memcpy(rt->playpath, "mp4:", 5);
} else if (!strcmp(fname + len - 4, ".flv")) { } else if (len >= 4 && !strcmp(fname + len - 4, ".flv")) {
fname[len - 4] = '\0'; fname[len - 4] = '\0';
} else { } else {
rt->playpath[0] = 0; rt->playpath[0] = 0;
......
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