aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-13 23:43:16 +0100
committerMax Kellermann <max@duempel.org>2009-01-13 23:43:16 +0100
commit14527174593fcdfcc6ab67d6e4ff5af456431e18 (patch)
tree1a3e930f9c8d6c9373ff7edda4f6eba59f3a82d6 /src
parent45598d50e30df92a9e99c2471be00f7c8581fe91 (diff)
downloadmpd-14527174593fcdfcc6ab67d6e4ff5af456431e18.tar.gz
mpd-14527174593fcdfcc6ab67d6e4ff5af456431e18.tar.xz
mpd-14527174593fcdfcc6ab67d6e4ff5af456431e18.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.
Diffstat (limited to 'src')
-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 5fe3522e9..0a6e000e4 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;
}