genadb: fix maximum inner adb limit checking
parent
429e5984c5
commit
cd9aef8f7c
|
@ -272,13 +272,14 @@ struct adb_walk_gentext {
|
||||||
int key_printed : 1;
|
int key_printed : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ADB_WALK_GENADB_MAX_IDB 2
|
||||||
#define ADB_WALK_GENADB_MAX_NESTING 32
|
#define ADB_WALK_GENADB_MAX_NESTING 32
|
||||||
#define ADB_WALK_GENADB_MAX_VALUES 100000
|
#define ADB_WALK_GENADB_MAX_VALUES 100000
|
||||||
|
|
||||||
struct adb_walk_genadb {
|
struct adb_walk_genadb {
|
||||||
struct adb_walk d;
|
struct adb_walk d;
|
||||||
struct adb db;
|
struct adb db;
|
||||||
struct adb idb[2];
|
struct adb idb[ADB_WALK_GENADB_MAX_IDB];
|
||||||
int nest, nestdb, num_vals;
|
int nest, nestdb, num_vals;
|
||||||
struct adb_obj objs[ADB_WALK_GENADB_MAX_NESTING];
|
struct adb_obj objs[ADB_WALK_GENADB_MAX_NESTING];
|
||||||
unsigned int curkey[ADB_WALK_GENADB_MAX_NESTING];
|
unsigned int curkey[ADB_WALK_GENADB_MAX_NESTING];
|
||||||
|
|
|
@ -43,6 +43,7 @@ static int adb_walk_genadb_start_object(struct adb_walk *d)
|
||||||
|
|
||||||
if (*adb_ro_kind(&dt->objs[dt->nest-1], dt->curkey[dt->nest-1]) == ADB_KIND_ADB) {
|
if (*adb_ro_kind(&dt->objs[dt->nest-1], dt->curkey[dt->nest-1]) == ADB_KIND_ADB) {
|
||||||
struct adb_adb_schema *schema = container_of(&dt->objs[dt->nest-1].schema->kind, struct adb_adb_schema, kind);
|
struct adb_adb_schema *schema = container_of(&dt->objs[dt->nest-1].schema->kind, struct adb_adb_schema, kind);
|
||||||
|
if (dt->nestdb >= ARRAY_SIZE(dt->idb)) return -E2BIG;
|
||||||
adb_reset(&dt->idb[dt->nestdb]);
|
adb_reset(&dt->idb[dt->nestdb]);
|
||||||
dt->idb[dt->nestdb].hdr.schema = htole32(schema->schema_id);
|
dt->idb[dt->nestdb].hdr.schema = htole32(schema->schema_id);
|
||||||
dt->objs[dt->nest].db = &dt->idb[dt->nestdb];
|
dt->objs[dt->nest].db = &dt->idb[dt->nestdb];
|
||||||
|
|
Loading…
Reference in New Issue