diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2008-01-25 21:21:41 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2008-01-25 21:21:41 +0000 |
commit | b4f80fb93fe290d4498a9f1eecd2f15f0c19abf8 (patch) | |
tree | 4dac4deeeba89d37a04dff9add5b1d2424e5abde /apps | |
parent | 506d18b0e65479d8560ac0f10308fb55c39c7215 (diff) | |
download | rockbox-b4f80fb93fe290d4498a9f1eecd2f15f0c19abf8.tar.gz rockbox-b4f80fb93fe290d4498a9f1eecd2f15f0c19abf8.zip |
Fix a bug in tagcache tag length check, thanks to Rhino Banga.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16166 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tagcache.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 089161abab..6c38300a16 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -1608,7 +1608,7 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename) | |||
1608 | static inline void write_item(const char *item) | 1608 | static inline void write_item(const char *item) |
1609 | { | 1609 | { |
1610 | int len = strlen(item) + 1; | 1610 | int len = strlen(item) + 1; |
1611 | 1611 | ||
1612 | data_size += len; | 1612 | data_size += len; |
1613 | write(cachefd, item, len); | 1613 | write(cachefd, item, len); |
1614 | } | 1614 | } |
@@ -1616,21 +1616,21 @@ static inline void write_item(const char *item) | |||
1616 | static int check_if_empty(char **tag) | 1616 | static int check_if_empty(char **tag) |
1617 | { | 1617 | { |
1618 | int length; | 1618 | int length; |
1619 | 1619 | ||
1620 | if (*tag == NULL || *tag[0] == '\0') | 1620 | if (*tag == NULL || **tag == '\0') |
1621 | { | 1621 | { |
1622 | *tag = UNTAGGED; | 1622 | *tag = UNTAGGED; |
1623 | return sizeof(UNTAGGED); /* Tag length */ | 1623 | return sizeof(UNTAGGED); /* Tag length */ |
1624 | } | 1624 | } |
1625 | 1625 | ||
1626 | length = strlen(*tag); | 1626 | length = strlen(*tag); |
1627 | if (length > TAG_MAXLEN) | 1627 | if (length > TAG_MAXLEN) |
1628 | { | 1628 | { |
1629 | logf("over length tag: %s", *tag); | 1629 | logf("over length tag: %s", *tag); |
1630 | length = TAG_MAXLEN; | 1630 | length = TAG_MAXLEN; |
1631 | *tag[length] = '\0'; | 1631 | (*tag)[length] = '\0'; |
1632 | } | 1632 | } |
1633 | 1633 | ||
1634 | return length + 1; | 1634 | return length + 1; |
1635 | } | 1635 | } |
1636 | 1636 | ||