]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pidl: Parenthesize expression to be cast
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 10 May 2021 22:27:33 +0000 (10:27 +1200)
committerJoseph Sutton <jsutton@samba.org>
Sun, 1 Oct 2023 22:45:38 +0000 (22:45 +0000)
We must parenthesize each expression that is to be cast to a specific
type, otherwise the cast will apply to only part of the full expression.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9914

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index d5506d8c21d637f5cf40a0ab106c892596b985e3..a631bad3031c35763f5174299a88a4cac662ad64 100644 (file)
@@ -926,7 +926,7 @@ sub ParseElementPrint($$$$$)
                        } else {
                                my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
 
-                               $self->pidl("$ndr->print($ndr, \"%s: ARRAY(%\"PRIu32\")\", \"$e->{NAME}\", (uint32_t)$length);");
+                               $self->pidl("$ndr->print($ndr, \"%s: ARRAY(%\"PRIu32\")\", \"$e->{NAME}\", (uint32_t)($length));");
                                $self->pidl("$ndr->depth++;");
                                $self->pidl("for ($counter = 0; $counter < ($length); $counter++) {");
                                $self->indent;