summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-24 17:51:32 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-24 17:51:32 +0200
commit0f15824322f8752acf9ece4fc54bf53a7a4e9c57 (patch)
treeee519ca569d3197a3ba5899ba57fad037813849a /lib
parent8f60ea029a81e1419c4b6f95a1fdf4b166c4efd2 (diff)
Fix zero size stack array allocation in write_inode
Simply skip copying of file blocks if there are none. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/write_inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqfs/write_inode.c b/lib/sqfs/write_inode.c
index e64e6a6..422959e 100644
--- a/lib/sqfs/write_inode.c
+++ b/lib/sqfs/write_inode.c
@@ -63,7 +63,7 @@ int sqfs_meta_writer_write_inode(sqfs_meta_writer_t *ir,
ret = sqfs_meta_writer_append(ir, &file, sizeof(file));
if (ret)
return ret;
- return write_block_sizes(ir, n);
+ return n->num_file_blocks ? write_block_sizes(ir, n) : 0;
}
case SQFS_INODE_SLINK: {
sqfs_inode_slink_t slink = {
@@ -117,7 +117,7 @@ int sqfs_meta_writer_write_inode(sqfs_meta_writer_t *ir,
ret = sqfs_meta_writer_append(ir, &file, sizeof(file));
if (ret)
return ret;
- return write_block_sizes(ir, n);
+ return n->num_file_blocks ? write_block_sizes(ir, n) : 0;
}
case SQFS_INODE_EXT_SLINK: {
sqfs_inode_slink_t slink = {