From 40ca906fa9f2f0e4e325432aff00433f2bb731bd Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 7 Nov 2020 17:06:33 +0100 Subject: Fix: libsquashfs: xattr_writer: return NULL if calloc fails Instead of dereferencing the NULL pointer and crashing. Signed-off-by: David Oberhollenzer --- lib/sqfs/xattr/xattr_writer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/sqfs/xattr/xattr_writer.c b/lib/sqfs/xattr/xattr_writer.c index c33d366..c04bd4a 100644 --- a/lib/sqfs/xattr/xattr_writer.c +++ b/lib/sqfs/xattr/xattr_writer.c @@ -89,6 +89,9 @@ sqfs_xattr_writer_t *sqfs_xattr_writer_create(sqfs_u32 flags) return NULL; xwr = calloc(1, sizeof(*xwr)); + if (xwr == NULL) + return NULL; + if (str_table_init(&xwr->keys, XATTR_KEY_BUCKETS)) goto fail_keys; -- cgit v1.2.3