From: Eric Biggers Date: Wed, 18 Jan 2017 04:32:54 +0000 (-0800) Subject: xattr.h: statically verify size of xattr header X-Git-Tag: v1.11.0~3 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=442113f2d338903274e4bb30e91c2564919145f3 xattr.h: statically verify size of xattr header --- diff --git a/include/wimlib/xattr.h b/include/wimlib/xattr.h index e2eee000..2fc5f6dc 100644 --- a/include/wimlib/xattr.h +++ b/include/wimlib/xattr.h @@ -45,6 +45,8 @@ struct wimlib_xattr_entry { static inline size_t xattr_entry_size(const struct wimlib_xattr_entry *entry) { + STATIC_ASSERT(sizeof(*entry) == 8); + return ALIGN(sizeof(*entry) + le16_to_cpu(entry->name_len) + le32_to_cpu(entry->value_len), 4); }