From 14527174593fcdfcc6ab67d6e4ff5af456431e18 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 13 Jan 2009 23:43:16 +0100 Subject: 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. --- src/song_save.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/song_save.c') diff --git a/src/song_save.c b/src/song_save.c index 5fe3522e..0a6e000e 100644 --- a/src/song_save.c +++ b/src/song_save.c @@ -91,8 +91,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; } -- cgit v1.2.3