aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-13 23:43:16 +0100
committerMax Kellermann <max@duempel.org>2009-01-14 09:58:25 +0100
commit525c507ac56815c295a3c671725c60bfe03baabc (patch)
treee87ae161715fe428ac55de425ce75ea548f7fff9
parent7320db5af2cca2040520694aed4996eb84dba323 (diff)
downloadmpd-525c507ac56815c295a3c671725c60bfe03baabc.tar.gz
mpd-525c507ac56815c295a3c671725c60bfe03baabc.tar.xz
mpd-525c507ac56815c295a3c671725c60bfe03baabc.zip
song_save: check for colon and space when loading a tag
matchesAnMpdTagItemKey() broke when two tag items had the same prefix, because it did not check if the tag name ended after the prefix. Add a check for the colon and the space after the tag name.
-rw-r--r--src/song_save.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/song_save.c b/src/song_save.c
index 41e694611..5d446c8f7 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -90,8 +90,10 @@ static int matchesAnMpdTagItemKey(char *buffer, int *itemType)
int i;
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
- if (0 == strncmp(mpdTagItemKeys[i], buffer,
- strlen(mpdTagItemKeys[i]))) {
+ size_t len = strlen(mpdTagItemKeys[i]);
+
+ if (0 == strncmp(mpdTagItemKeys[i], buffer, len) &&
+ buffer[len] == ':' && buffer[len + 1] == ' ') {
*itemType = i;
return 1;
}