From 018e0e0a8e3c36a6bedf60eedeb8262311d90869 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 23 Oct 2019 13:50:17 +0200 Subject: Fix sqfs_dir_writer_add_entry behaviour on empty strings SquashFS cannot represent empty string file names in the directory entry structure, so reject them and report an error. Signed-off-by: David Oberhollenzer --- lib/sqfs/dir_writer.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqfs') diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c index 5b0ce7a..8703b77 100644 --- a/lib/sqfs/dir_writer.c +++ b/lib/sqfs/dir_writer.c @@ -129,6 +129,9 @@ int sqfs_dir_writer_add_entry(sqfs_dir_writer_t *writer, const char *name, if (type < 0) return type; + if (name[0] == '\0') + return SQFS_ERROR_CORRUPTED; + ent = alloc_flex(sizeof(*ent), 1, strlen(name)); if (ent == NULL) return SQFS_ERROR_ALLOC; -- cgit v1.2.3