From: Joseph Sutton Date: Tue, 4 May 2021 02:09:44 +0000 (+1200) Subject: ndr: Parenthesize expressions to be cast X-Git-Tag: tevent-0.16.0~285 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26e40717aa02106bd9a9b86157ba4cc25bfa98b7;p=thirdparty%2Fsamba.git ndr: Parenthesize expressions to be cast 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 Reviewed-by: Andrew Bartlett --- diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 1ec037628a7..d5506d8c21d 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -371,7 +371,7 @@ sub ParseArrayPullGetSize($$$$$$) } else { $self->pidl("if ($array_size < $low || $array_size > $high) {"); } - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value (%\"PRIu32\") out of range (%\"PRIu32\" - %\"PRIu32\")\", $array_size, (uint32_t)$low, (uint32_t)$high);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value (%\"PRIu32\") out of range (%\"PRIu32\" - %\"PRIu32\")\", $array_size, (uint32_t)($low), (uint32_t)($high));"); $self->pidl("}"); } @@ -411,7 +411,7 @@ sub ParseArrayPullGetLength($$$$$$;$) } else { $self->pidl("if ($array_length < $low || $array_length > $high) {"); } - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value (%\"PRIu32\") out of range (%\"PRIu32\" - %\"PRIu32\")\", $array_length, (uint32_t)$low, (uint32_t)$high);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value (%\"PRIu32\") out of range (%\"PRIu32\" - %\"PRIu32\")\", $array_length, (uint32_t)($low), (uint32_t)($high));"); $self->pidl("}"); } @@ -1050,7 +1050,7 @@ sub ParseDataPull($$$$$$$) } } - $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value (%$fmt) out of range (%$fmt - %$fmt)\", ($data_type)$var_name, ($data_type)$low, ($data_type)$high);"); + $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value (%$fmt) out of range (%$fmt - %$fmt)\", ($data_type)($var_name), ($data_type)($low), ($data_type)($high));"); $self->pidl("}"); } } else {