Commit 0ce727d5 authored by Max Kellermann's avatar Max Kellermann

ape: added protection against large memory allocations

The function tag_ape_load() retrieves a 32 bit unsigned integer from the input file, and passes it to g_malloc(). This is dangerous, and may be used for a denial of service attack on MPD.
parent e3ff0ab6
ver 0.15.2 (2009/??/??)
* tags:
- ape: check the tag size (fixes integer underflow)
- ape: added protection against large memory allocations
ver 0.15.1 (2009/07/15)
......
......@@ -89,6 +89,9 @@ tag_ape_load(const char *file)
tagLen = GUINT32_FROM_LE(footer.length);
if (tagLen <= sizeof(footer) + 10)
goto fail;
if (tagLen > 1024 * 1024)
/* refuse to load more than one megabyte of tag data */
goto fail;
if (fseek(fp, size - tagLen, SEEK_SET))
goto fail;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment