netlink: descend into nested parsers when verifying
When we verify that the attributes are correctly sorted we should also
try to verify the nested attribute parsers.
Reviewed by: melifaro
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D42222
This commit is contained in:
@@ -289,6 +289,14 @@ nl_verify_parsers(const struct nlhdr_parser **parser, int count)
|
||||
for (int j = 0; j < p->np_size; j++) {
|
||||
MPASS(p->np[j].type > attr_type);
|
||||
attr_type = p->np[j].type;
|
||||
|
||||
/* Recurse into nested objects. */
|
||||
if (p->np[j].cb == nlattr_get_nested ||
|
||||
p->np[j].cb == nlattr_get_nested_ptr) {
|
||||
const struct nlhdr_parser *np =
|
||||
(const struct nlhdr_parser *)p->np[j].arg;
|
||||
nl_verify_parsers(&np, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user