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
This commit is contained in:
parent
506d18b0e6
commit
b4f80fb93f
1 changed files with 6 additions and 6 deletions
|
@ -1608,7 +1608,7 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename)
|
||||||
static inline void write_item(const char *item)
|
static inline void write_item(const char *item)
|
||||||
{
|
{
|
||||||
int len = strlen(item) + 1;
|
int len = strlen(item) + 1;
|
||||||
|
|
||||||
data_size += len;
|
data_size += len;
|
||||||
write(cachefd, item, len);
|
write(cachefd, item, len);
|
||||||
}
|
}
|
||||||
|
@ -1616,21 +1616,21 @@ static inline void write_item(const char *item)
|
||||||
static int check_if_empty(char **tag)
|
static int check_if_empty(char **tag)
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
if (*tag == NULL || *tag[0] == '\0')
|
if (*tag == NULL || **tag == '\0')
|
||||||
{
|
{
|
||||||
*tag = UNTAGGED;
|
*tag = UNTAGGED;
|
||||||
return sizeof(UNTAGGED); /* Tag length */
|
return sizeof(UNTAGGED); /* Tag length */
|
||||||
}
|
}
|
||||||
|
|
||||||
length = strlen(*tag);
|
length = strlen(*tag);
|
||||||
if (length > TAG_MAXLEN)
|
if (length > TAG_MAXLEN)
|
||||||
{
|
{
|
||||||
logf("over length tag: %s", *tag);
|
logf("over length tag: %s", *tag);
|
||||||
length = TAG_MAXLEN;
|
length = TAG_MAXLEN;
|
||||||
*tag[length] = '\0';
|
(*tag)[length] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return length + 1;
|
return length + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue