pidl/NDR/Parser: use ParseArrayPullGetLength() to get the number of array elements...
authorStefan Metzmacher <metze@samba.org>
Thu, 15 Mar 2012 12:07:47 +0000 (13:07 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Apr 2012 18:19:45 +0000 (20:19 +0200)
An anonymous researcher and Brian Gorenc (HP DVLabs) working
with HP's Zero Day Initiative program have found this and notified us.

metze
(cherry picked from commit 8e99484dec90690ec1e00c17580150278963e063)

pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index e97c40052dbd46cba3b206f1e0a3e22106cfa76b..09ba7232c21b1bdd8ed257dbfefd50d54eae22dc 100644 (file)
@@ -1120,14 +1120,10 @@ sub ParseElementPullLevel
                }
        } elsif ($l->{TYPE} eq "ARRAY" and 
                        not has_fast_array($e,$l) and not is_charset_array($e, $l)) {
-               my $length = ParseExpr($l->{LENGTH_IS}, $env, $e->{ORIGINAL});
+               my $length = $self->ParseArrayPullGetLength($e, $l, $ndr, $var_name, $env);
                my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
                my $array_name = $var_name;
 
-               if ($l->{IS_VARYING}) {
-                       $length = "ndr_get_array_length($ndr, " . get_pointer_to($var_name) .")";
-               }
-
                if (my $range = has_property($e, "range")) {
                        my ($low, $high) = split(/,/, $range, 2);
                        if ($low < 0) {