summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-08-19 07:24:46 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-30 14:31:35 +0200
commit9a2e1715a3d55971a2bb0be8d2449823937caa9e (patch)
tree74115f4f2609457c0e96fea09ab8ddfc1b425e31 /src
parentb2e3a2218b15175927e78649a4cccae02020c736 (diff)
downloadsssd-9a2e1715a3d55971a2bb0be8d2449823937caa9e.tar.gz
sssd-9a2e1715a3d55971a2bb0be8d2449823937caa9e.tar.xz
sssd-9a2e1715a3d55971a2bb0be8d2449823937caa9e.zip
mmap_cache: Use stricter check for hash keys.sssd-1.9.2-125.el6
ht_size is size of hash_table in bytes, but hash keys have type uint32_t
Diffstat (limited to 'src')
-rw-r--r--src/responder/nss/nsssrv_mmap_cache.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index f0d8c2518..673ab1a5a 100644
--- a/src/responder/nss/nsssrv_mmap_cache.c
+++ b/src/responder/nss/nsssrv_mmap_cache.c
@@ -168,7 +168,7 @@ static void sss_mc_add_rec_to_chain(struct sss_mc_ctx *mcc,
struct sss_mc_rec *cur;
uint32_t slot;
- if (hash > mcc->ht_size) {
+ if (hash > MC_HT_ELEMS(mcc->ht_size)) {
/* Invalid hash. This should never happen, but better
* return than trying to access out of bounds memory */
return;
@@ -225,9 +225,11 @@ static void sss_mc_rm_rec_from_chain(struct sss_mc_ctx *mcc,
struct sss_mc_rec *cur = NULL;
uint32_t slot;
- if (hash > mcc->ht_size) {
- /* Invalid hash. This should never happen, but better
- * return than trying to access out of bounds memory */
+ if (hash > MC_HT_ELEMS(mcc->ht_size)) {
+ /* It can happen if rec->hash1 and rec->hash2 was the same.
+ * or it is invalid hash. It is better to return
+ * than trying to access out of bounds memory
+ */
return;
}