X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Fcheck.c;h=42f7538edf97a899d9a3758b78c3ec59bf1c2dfb;hp=f8abfc1fad4e30f20829e96cb6e557e0630efc45;hb=cb399d268c839dd75a59678268f3ba666147cc20;hpb=25ed8785693e98492c0c516a8845866ec784f2b9 diff --git a/ccan/tdb2/check.c b/ccan/tdb2/check.c index f8abfc1f..42f7538e 100644 --- a/ccan/tdb2/check.c +++ b/ccan/tdb2/check.c @@ -372,6 +372,14 @@ int tdb_check(struct tdb_context *tdb, if (tdb->methods->oob(tdb, off + len, false)) goto fail; + if (len < sizeof(p->f)) { + tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv, + "tdb_check: too short record %llu at" + " %llu\n", + (long long)len, (long long)off); + goto fail; + } + if (off + sizeof(p->u) == tdb->header.v.hash_off) { hash_found = true; } else if (off + sizeof(p->u)