Fixes to make_ext4fs when compiled with HAVE_SELINUX.
Fix a segfault in contents.c.
Change-Id: I77c39b2cda5f3aa572b5ed8a4f2e5da78341eed6
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index 71143bc..76208fc 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -259,7 +259,7 @@
u32 *hdr;
struct ext4_xattr_entry *entry;
size_t name_len = strlen(XATTR_SELINUX_SUFFIX);
- size_t value_len = strlen(secon)+1;
+ size_t value_len;
size_t size, min_offs;
char *val;
@@ -276,6 +276,7 @@
entry->e_name_index = EXT4_XATTR_INDEX_SECURITY;
entry->e_name_len = name_len;
memcpy(entry->e_name, XATTR_SELINUX_SUFFIX, name_len);
+ value_len = strlen(secon)+1;
entry->e_value_size = cpu_to_le32(value_len);
min_offs = (char *)inode + info.inode_size - (char*) entry;
size = EXT4_XATTR_SIZE(value_len);