X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Fhash.c;h=7ade36d35d24521c8e62645b33da35d9d373fda4;hb=115648946c7a78e87fb45eac6c1759a347d4c7f8;hp=d4d08e420d878f6e35f60fac9cac1bbbcb5a840f;hpb=f2c286c95f808520e0904b320dccc3680868f6ab;p=ccan-lca-2011.git diff --git a/ccan/tdb2/hash.c b/ccan/tdb2/hash.c index d4d08e4..7ade36d 100644 --- a/ccan/tdb2/hash.c +++ b/ccan/tdb2/hash.c @@ -108,12 +108,16 @@ static bool match(struct tdb_context *tdb, if (tdb_read_convert(tdb, off, rec, sizeof(*rec)) == -1) return ret; - /* FIXME: check extra bits in header? */ if (rec_key_length(rec) != key->dsize) { add_stat(tdb, compare_wrong_keylen, 1); return ret; } + if ((h->h & ((1 << 11)-1)) != rec_hash(rec)) { + add_stat(tdb, compare_wrong_rechash, 1); + return false; + } + rkey = tdb_access_read(tdb, off + sizeof(*rec), key->dsize, false); if (!rkey) return ret;