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:
Samuel Pitoiset 2012-06-11 14:21:32 +02:00 committed by Martin Storsjö
parent f862537de8
commit 0a9a225733
1 changed files with 2 additions and 2 deletions

View File

@ -1141,11 +1141,11 @@ static int rtmp_open(URLContext *s, const char *uri, int flags)
goto fail;
}
if (!strchr(fname, ':') &&
if (!strchr(fname, ':') && len >= 4 &&
(!strcmp(fname + len - 4, ".f4v") ||
!strcmp(fname + len - 4, ".mp4"))) {
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';
} else {
rt->playpath[0] = 0;