Revision 12ad6671 libavformat/asfdec.c

View differences:

libavformat/asfdec.c
152 152

  
153 153
static void get_tag(AVFormatContext *s, const char *key, int type, int len)
154 154
{
155
    char value[1024];
155
    char *value;
156

  
157
    if ((unsigned)len >= UINT_MAX)
158
        return;
159

  
160
    value = av_malloc(len+1);
161
    if (!value)
162
        return;
163

  
156 164
    if (type <= 1) {         // unicode or byte
157
        get_str16_nolen(s->pb, len, value, sizeof(value));
165
        get_str16_nolen(s->pb, len, value, len);
158 166
    } else if (type <= 5) {  // boolean or DWORD or QWORD or WORD
159 167
        uint64_t num = get_value(s->pb, type);
160
        snprintf(value, sizeof(value), "%"PRIu64, num);
168
        snprintf(value, len, "%"PRIu64, num);
161 169
    } else {
162 170
        url_fskip(s->pb, len);
163 171
        return;
164 172
    }
165 173
    if (!strncmp(key, "WM/", 3))
166 174
        key += 3;
167
    av_metadata_set(&s->metadata, key, value);
175
    av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
168 176
}
169 177

  
170 178
static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)

Also available in: Unified diff