aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/webmdashenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-08-29 13:02:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-08-29 13:02:34 +0200
commit72732f2dddabae1d943ce617e0a27e32d13416fb (patch)
tree630bc63e0ca30cb706bbeccea3dab77474acd2a5 /libavformat/webmdashenc.c
parent5ce98e774eead9a2b785df577b4b483df6e63008 (diff)
downloadffmpeg-72732f2dddabae1d943ce617e0a27e32d13416fb.tar.gz
avformat/webmdashenc: use av_strlcpy() and allocate enough space
Fixes out of array read Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/webmdashenc.c')
-rw-r--r--libavformat/webmdashenc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index fc77c247c7..77f6170a26 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -203,7 +203,7 @@ static int to_integer(char *p, int len)
int ret;
char *q = av_malloc(sizeof(char) * len);
if (!q) return -1;
- strncpy(q, p, len);
+ av_strlcpy(q, p, len);
ret = atoi(q);
av_free(q);
return ret;
@@ -240,7 +240,7 @@ static int parse_adaptation_sets(AVFormatContext *s)
while (*q != '\0' && *q != ',' && *q != ' ') q++;
as->streams = av_realloc(as->streams, sizeof(*as->streams) * ++as->nb_streams);
if (as->streams == NULL) return -1;
- as->streams[as->nb_streams - 1] = to_integer(p, q - p);
+ as->streams[as->nb_streams - 1] = to_integer(p, q - p + 1);
if (as->streams[as->nb_streams - 1] < 0) return -1;
if (*q == '\0') break;
if (*q == ' ') state = new_set;