From f001ce92f87bbf06b2d94942b935ad7613a47cae Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 19 Nov 2012 10:43:29 +1030 Subject: [PATCH] tal: bounds checking fixes. First, we need to update the bounds for the group property allocated with the children property, just in case it's at the end of the allocations. Second, we need to allow the tal_check() code to accept the pointer to the null parent's group property. Signed-off-by: Rusty Russell --- ccan/tal/tal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ccan/tal/tal.c b/ccan/tal/tal.c index 612c67bb..32cfd043 100644 --- a/ccan/tal/tal.c +++ b/ccan/tal/tal.c @@ -294,6 +294,7 @@ static struct children *add_child_property(struct tal_hdr *parent, init_group_property(&prop->group, prop, child); list_head_init(&prop->group.list); + update_bounds(&prop->group); } return prop; } @@ -887,7 +888,8 @@ static bool check_node(struct group *group, name = (struct name *)p; break; } - if (p != &null_parent.c.hdr && !in_bounds(p)) + if (p != &null_parent.c.hdr && p != &null_parent.c.group.hdr + && !in_bounds(p)) return check_err(t, errorstr, "has bad property pointer"); -- 2.39.2