summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-05-06 13:53:45 +0200
committerVolker Lendecke <vl@samba.org>2008-05-06 13:56:21 +0200
commit3643aa9a63588b60797cb13e00a46e6c5dc845e8 (patch)
treef54d4749ee8cbac8f1eb9fd1aecb15c9e7140c88
parent0c11e174eefa91029bfd78453639f23bef42c69e (diff)
downloadsamba-3643aa9a63588b60797cb13e00a46e6c5dc845e8.tar.gz
samba-3643aa9a63588b60797cb13e00a46e6c5dc845e8.tar.bz2
samba-3643aa9a63588b60797cb13e00a46e6c5dc845e8.zip
Fix a panic in the [ug]id2sid valgrind bug fix
Always, always run "make test" before pushing stuff :-) (This used to be commit 1444db8be1de00a3e9c805f1accd8f1f4670d729)
-rw-r--r--source3/passdb/lookup_sid.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index debd67b136..a7175b9647 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -1012,8 +1012,9 @@ static bool fetch_sid_from_uid_cache(DOM_SID *psid, uid_t uid)
return false;
}
- SMB_ASSERT(cache_value.length == sizeof(*psid));
- memcpy(psid, cache_value.data, sizeof(*psid));
+ memcpy(psid, cache_value.data, MIN(sizeof(*psid), cache_value.length));
+ SMB_ASSERT(cache_value.length >= offsetof(struct dom_sid, id_auth));
+ SMB_ASSERT(cache_value.length == ndr_size_dom_sid(psid, 0));
return true;
}
@@ -1066,8 +1067,9 @@ static bool fetch_sid_from_gid_cache(DOM_SID *psid, gid_t gid)
return false;
}
- SMB_ASSERT(cache_value.length == sizeof(*psid));
- memcpy(psid, cache_value.data, sizeof(*psid));
+ memcpy(psid, cache_value.data, MIN(sizeof(*psid), cache_value.length));
+ SMB_ASSERT(cache_value.length >= offsetof(struct dom_sid, id_auth));
+ SMB_ASSERT(cache_value.length == ndr_size_dom_sid(psid, 0));
return true;
}