static void
cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
{
- memcpy(dst, src, sizeof(*dst));
+ int i;
+
+ dst->revision = src->revision;
dst->num_subauth = min_t(u8, src->num_subauth, NUM_SUBAUTHS);
+ for (i = 0; i < NUM_AUTHS; ++i)
+ dst->authority[i] = src->authority[i];
+ for (i = 0; i < dst->num_subauth; ++i)
+ dst->sub_auth[i] = src->sub_auth[i];
}
static void
if (IS_ERR(sidkey)) {
rc = -EINVAL;
cFYI(1, "%s: Can't map and id to a SID", __func__);
- } else if (sidkey->datalen < sizeof(struct cifs_sid)) {
+ } else if (sidkey->datalen < CIFS_SID_BASE_SIZE) {
rc = -EIO;
cFYI(1, "%s: Downcall contained malformed key "
"(datalen=%hu)", __func__, sidkey->datalen);
__le32 sub_auth[NUM_SUBAUTHS]; /* sub_auth[num_subauth] */
} __attribute__((packed));
+/* size of a struct cifs_sid, sans sub_auth array */
+#define CIFS_SID_BASE_SIZE (1 + 1 + NUM_AUTHS)
+
struct cifs_acl {
__le16 revision; /* revision level */
__le16 size;