summaryrefslogtreecommitdiff
path: root/apps/metadata.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata.c')
-rw-r--r--apps/metadata.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/metadata.c b/apps/metadata.c
index 797192080f..9cb055608a 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -643,7 +643,8 @@ static bool get_vorbis_metadata(int fd, struct mp3entry* id3)
* by ('O','g','g','S',0) and retrieve totalsamples.
*/
- if (lseek(fd, -64 * 1024, SEEK_END) < 0) /* A page is always < 64 kB */
+ /* A page is always < 64 kB */
+ if (lseek(fd, -(MIN(64 * 1024, id3->filesize)), SEEK_END) < 0)
{
return false;
}