From 9a2674b090f469e1c75f5dc4048c8a20574f9f9b Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sun, 30 Jul 2000 13:10:10 +0000 Subject: [PATCH] Oops. Couple of significant (though not usually fatal) bugs in the new comment API. Probably doesn't affect anyone, since these APIs haven't really been used yet. svn path=/trunk/vorbis/; revision=537 --- lib/info.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/info.c b/lib/info.c index 175d7c8..cd35072 100644 --- a/lib/info.c +++ b/lib/info.c @@ -12,7 +12,7 @@ ******************************************************************** function: maintain the info structure, info <-> header packets - last mod: $Id: info.c,v 1.26 2000/07/29 08:45:33 msmith Exp $ + last mod: $Id: info.c,v 1.27 2000/07/30 13:10:10 msmith Exp $ ********************************************************************/ @@ -73,7 +73,7 @@ void vorbis_comment_add(vorbis_comment *vc,char *comment){ void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){ char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ strcpy(comment, tag); - comment[strlen(tag)] = '='; + strcat(comment, "="); strcat(comment, contents); vorbis_comment_add(vc, comment); } @@ -94,9 +94,13 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ long i; int found = 0; int taglen = strlen(tag); + char *fulltag = alloca(taglen+ 2); + + strcpy(fulltag, tag); + strcat(fulltag, "="); for(i=0;icomments;i++){ - if(!tagcompare(vc->user_comments[i], tag, taglen)){ + if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ if(count == found) /* We return a pointer to the data, not a copy */ return vc->user_comments[i] + taglen + 1; -- 2.7.4