- p = search_pattern(comment_header, sizeof(comment_header),
- buf, buf_size);
- if (p) {
- int len1, len2, len3, len4, len5;
- p += 24;
- len1 = read_u16(p);
- p += 2;
- len2 = read_u16(p);
- p += 2;
- len3 = read_u16(p);
- p += 2;
- len4 = read_u16(p);
- p += 2;
- len5 = read_u16(p);
- p += 2;
- /* TODO: Check len values */
- get_str16(p, len1, tag, sizeof(tag));
- ti->title = para_strdup(tag);
- PARA_INFO_LOG("title: %s\n", tag);
- get_str16(p + len1, len2, tag, sizeof(tag));
- ti->artist = para_strdup(tag);
- PARA_INFO_LOG("artist: %s\n", tag);
- get_str16(p + len1 + len2 + len3 + len4, len5, tag, sizeof(tag));
- ti->comment = para_strdup(tag);
- PARA_INFO_LOG("comment: %s\n", tag);
- } else
- PARA_NOTICE_LOG("comment header not found\n");
+ p = search_pattern(content_description_header,
+ sizeof(content_description_header), buf, buf_size);
+ if (!p || p + 34 >= end) {
+ PARA_NOTICE_LOG("content description header not found\n");
+ goto next;
+ }
+ p += 24;
+ len1 = read_u16(p);
+ p += 2;
+ len2 = read_u16(p);
+ p += 2;
+ len3 = read_u16(p);
+ p += 2;
+ len4 = read_u16(p);
+ p += 2;
+ /* ignore length of the rating information */
+ p += 2;
+ if (p + len1 >= end)
+ goto next;
+ ti->title = get_str16(p, len1);
+ p += len1;
+ if (p + len2 >= end)
+ goto next;
+ ti->artist = get_str16(p, len2);
+ p += len2 + len3;
+ if (p + len4 >= end)
+ goto next;
+ ti->comment = get_str16(p, len4);
+next: