aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-10-23 13:50:17 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-10-23 13:56:33 +0200
commit018e0e0a8e3c36a6bedf60eedeb8262311d90869 (patch)
tree3e7a59c6b0c56112020cd6b43343ca4a11d9f21b /lib/sqfs
parentcde9624b78d2faadca8e8a29d8c5bcd167641436 (diff)
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 <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/dir_writer.c3
1 files changed, 3 insertions, 0 deletions
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;