rtmp: Fix a possible access to invalid memory location when the playpath is too short.
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
f862537de8
commit
0a9a225733
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user