1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

registry: Add error checks to regdb_fetch_keys_internal

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2018-10-02 13:16:04 +02:00 committed by Jeremy Allison
parent 1fb2d10d38
commit 2a35cbb02f

View File

@ -1784,7 +1784,23 @@ static WERROR regdb_fetch_keys_internal(struct db_context *db, const char *key,
}
for (i=0; i<num_items; i++) {
len += tdb_unpack(buf+len, buflen-len, "f", subkeyname);
int this_len;
this_len = tdb_unpack(buf+len, buflen-len, "f", subkeyname);
if (this_len == -1) {
DBG_WARNING("Invalid registry data, "
"tdb_unpack failed\n");
werr = WERR_INTERNAL_DB_CORRUPTION;
goto done;
}
len += this_len;
if (len < this_len) {
DBG_WARNING("Invalid registry data, "
"integer overflow\n");
werr = WERR_INTERNAL_DB_CORRUPTION;
goto done;
}
werr = regsubkey_ctr_addkey(ctr, subkeyname);
if (!W_ERROR_IS_OK(werr)) {
DEBUG(5, ("regdb_fetch_keys: regsubkey_ctr_addkey "