1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

pidl: Add recursive depth checks.

Add new parameter to elements "max_recursion" and modify pidl to call
NDR_RECURSION_CHECK and NDR_RECURSION_UNWIND for element tagged with
that attribute.

Credit to OSS-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19820
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14254

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Gary Lockyer 2020-01-30 08:51:47 +13:00 committed by Andrew Bartlett
parent ba518a1deb
commit 5d323f2a2e
2 changed files with 8 additions and 0 deletions

View File

@ -1101,6 +1101,7 @@ my %property_list = (
"gensize" => ["TYPEDEF", "STRUCT", "UNION"],
"value" => ["ELEMENT"],
"flag" => ["ELEMENT", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "PIPE"],
"max_recursion" => ["ELEMENT"],
# generic
"public" => ["FUNCTION", "TYPEDEF", "STRUCT", "UNION", "ENUM", "BITMAP", "PIPE"],

View File

@ -993,7 +993,14 @@ sub ParseDataPull($$$$$$$)
$var_name = get_pointer_to($var_name);
if (my $depth = has_property($e, "max_recursion")) {
my $d = parse_int($depth);
$self->pidl("NDR_RECURSION_CHECK($ndr, $d);");
}
$self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
if (has_property($e, "max_recursion")) {
$self->pidl("NDR_RECURSION_UNWIND($ndr);");
}
my $pl = GetPrevLevel($e, $l);