summaryrefslogtreecommitdiff
path: root/libavformat/asfdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-12-13 20:27:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-12-13 20:27:29 +0000
commit12ad66712a18d039eea73a742ae626b2376f8f4f (patch)
treef6d863c1a428480ad0366d48c44c8b89ef53b3e3 /libavformat/asfdec.c
parentb8f11ec8878641f699c07b8425079d3611a51072 (diff)
Use AV_METADATA_DONT_STRDUP* / use av_malloced metadata instead of strduped
arrays of fixed length. Code from ffmbc with changes to adapt to our metadata API. Originally committed as revision 20836 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/asfdec.c')
-rw-r--r--libavformat/asfdec.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 543faf29d4..78c99f3aa3 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -152,19 +152,27 @@ static int get_value(ByteIOContext *pb, int type){
static void get_tag(AVFormatContext *s, const char *key, int type, int len)
{
- char value[1024];
+ char *value;
+
+ if ((unsigned)len >= UINT_MAX)
+ return;
+
+ value = av_malloc(len+1);
+ if (!value)
+ return;
+
if (type <= 1) { // unicode or byte
- get_str16_nolen(s->pb, len, value, sizeof(value));
+ get_str16_nolen(s->pb, len, value, len);
} else if (type <= 5) { // boolean or DWORD or QWORD or WORD
uint64_t num = get_value(s->pb, type);
- snprintf(value, sizeof(value), "%"PRIu64, num);
+ snprintf(value, len, "%"PRIu64, num);
} else {
url_fskip(s->pb, len);
return;
}
if (!strncmp(key, "WM/", 3))
key += 3;
- av_metadata_set(&s->metadata, key, value);
+ av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
}
static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)