* If this field overflows the input, then *all*
* of the input is suspect.
*/
- if ((p + child_length) > end) {
+ if (child_length > (size_t) (end - p)) {
FR_PROTO_TRACE("fr_struct_from_network - child length %zd overflows buffer", child_length);
goto unknown;
}
- if (!child_length) child_length = (end - p);
+ /*
+ * The child is variable sized, OR it's an array.
+ * Eat up the rest of the data.
+ */
+ if (!child_length || (child->flags.array)) child_length = (end - p);
/*
* Magic values get the callback called.
break;
}
+ /*
+ * We don't handle this yet here.
+ */
+ fr_assert(!child->flags.array);
+
vp = fr_pair_afrom_da(child_ctx, child);
if (!vp) {
FR_PROTO_TRACE("fr_struct_from_network - failed allocating child VP");