summaryrefslogtreecommitdiff
path: root/libavformat/rtmpproto.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2012-06-11 14:21:32 +0200
committerMartin Storsjö <martin@martin.st>2012-06-12 14:33:57 +0300
commit0a9a2257339c8697be31e64b36fa6208132b11bd (patch)
tree400be17f0b4ca94262aee27548d97704b20b462b /libavformat/rtmpproto.c
parentf862537de8ba7920e0f25318c03f8982a3c6294c (diff)
rtmp: Fix a possible access to invalid memory location when the playpath is too short.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r--libavformat/rtmpproto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index e9a3e4336e..56011f1cde 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -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;