aboutsummaryrefslogtreecommitdiff
path: root/src/tag_ape.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tag_ape.c')
-rw-r--r--src/tag_ape.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tag_ape.c b/src/tag_ape.c
index 0d504dc7..ef921141 100644
--- a/src/tag_ape.c
+++ b/src/tag_ape.c
@@ -22,6 +22,7 @@
#include <glib.h>
+#include <assert.h>
#include <stdio.h>
struct tag *
@@ -86,15 +87,15 @@ tag_ape_load(const char *file)
/* find beginning of ape tag */
tagLen = GUINT32_FROM_LE(footer.length);
- if (tagLen < sizeof(footer))
+ if (tagLen <= sizeof(footer) + 10)
goto fail;
if (fseek(fp, size - tagLen, SEEK_SET))
goto fail;
/* read tag into buffer */
tagLen -= sizeof(footer);
- if (tagLen <= 0)
- goto fail;
+ assert(tagLen > 10);
+
buffer = g_malloc(tagLen);
if (fread(buffer, 1, tagLen, fp) != tagLen)
goto fail;