aports/main/squashfs-tools/vla-overlow.patch
Natanael Copa 2fafe3d1eb main/squashfs-tools: fix variable length array overflow
we can not guarantee that block size specified in user data will not
overflow the stack so we need to use malloc.

this fixes segfault when doing unsquashfs
2015-06-09 07:16:13 +00:00

22 lines
431 B
Diff

--- ./squashfs-tools/unsquashfs.c.orig
+++ ./squashfs-tools/unsquashfs.c
@@ -2099,7 +2099,9 @@
*/
void *inflator(void *arg)
{
- char tmp[block_size];
+ char *tmp = malloc(block_size);
+ if(tmp == NULL)
+ EXIT_UNSQUASH("Out of memory allocating block buffer\n");
while(1) {
struct cache_entry *entry = queue_get(to_inflate);
@@ -2122,6 +2124,7 @@
*/
cache_block_ready(entry, res == -1);
}
+ free(tmp);
}