summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/metadata.h2
-rw-r--r--apps/metadata/id3tags.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/apps/metadata.h b/apps/metadata.h
index 8c7188db24..f366aea61c 100644
--- a/apps/metadata.h
+++ b/apps/metadata.h
@@ -174,8 +174,10 @@ extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS];
#if MEMORYSIZE > 2
#define ID3V2_BUF_SIZE 900
+#define ID3V2_MAX_ITEM_SIZE 120
#else
#define ID3V2_BUF_SIZE 300
+#define ID3V2_MAX_ITEM_SIZE 60
#endif
enum {
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c
index f3ddd73077..75056a273c 100644
--- a/apps/metadata/id3tags.c
+++ b/apps/metadata/id3tags.c
@@ -836,6 +836,12 @@ void setid3v2title(int fd, struct mp3entry *entry)
if(framelen >= buffersize - bufferpos)
framelen = buffersize - bufferpos - 1;
+ /* Limit the maximum length of an id3 data item to ID3V2_MAX_ITEM_SIZE
+ bytes. This reduces the chance that the available buffer is filled
+ by single metadata items like large comments. */
+ if (ID3V2_MAX_ITEM_SIZE < framelen)
+ framelen = ID3V2_MAX_ITEM_SIZE;
+
logf("id3v2 frame: %.4s", header);
/* Check for certain frame headers