git.samba.org
/
kai
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
46123de
)
pidl/NDR/Parser: do array range validation in ParseArrayPullGetLength()
author
Stefan Metzmacher
<metze@samba.org>
Thu, 15 Mar 2012 12:14:48 +0000
(13:14 +0100)
committer
Karolin Seeger
<kseeger@samba.org>
Tue, 10 Apr 2012 14:48:07 +0000
(16:48 +0200)
metze
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
patch
|
blob
|
history
diff --git
a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 3dfb52192b2e9298a14a28b270b243b91cb16160..541e52926d1a8636f43aad799ba1457e8ad8483c 100644
(file)
--- a/
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/
pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@
-361,6
+361,20
@@
sub ParseArrayPullGetLength($$$$$$;$)
$array_length = "length_$e->{NAME}_$l->{LEVEL_INDEX}";
}
$array_length = "length_$e->{NAME}_$l->{LEVEL_INDEX}";
}
+ if (my $range = has_property($e, "range")) {
+ my ($low, $high) = split(/,/, $range, 2);
+ if ($low < 0) {
+ warning(0, "$low is invalid for the range of an array size");
+ }
+ if ($low == 0) {
+ $self->pidl("if ($array_length > $high) {");
+ } else {
+ $self->pidl("if ($array_length < $low || $array_length > $high) {");
+ }
+ $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
+ $self->pidl("}");
+ }
+
return $array_length;
}
return $array_length;
}
@@
-1081,20
+1095,6
@@
sub ParseElementPullLevel
my $length = $self->ParseArrayPullHeader($e, $l, $ndr, $var_name, $env);
$array_length = $length;
my $length = $self->ParseArrayPullHeader($e, $l, $ndr, $var_name, $env);
$array_length = $length;
- if (my $range = has_property($e, "range")) {
- my ($low, $high) = split(/,/, $range, 2);
- if ($low < 0) {
- warning(0, "$low is invalid for the range of an array size");
- }
- if ($low == 0) {
- $self->pidl("if ($length > $high) {");
- } else {
- $self->pidl("if ($length < $low || $length > $high) {");
- }
- $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
- $self->pidl("}");
- }
-
my $nl = GetNextLevel($e, $l);
if (is_charset_array($e,$l)) {
my $nl = GetNextLevel($e, $l);
if (is_charset_array($e,$l)) {
@@
-1169,20
+1169,6
@@
sub ParseElementPullLevel
$length = $self->ParseArrayPullGetLength($e, $l, $ndr, $var_name, $env);
}
$length = $self->ParseArrayPullGetLength($e, $l, $ndr, $var_name, $env);
}
- if (my $range = has_property($e, "range")) {
- my ($low, $high) = split(/,/, $range, 2);
- if ($low < 0) {
- warning(0, "$low is invalid for the range of an array size");
- }
- if ($low == 0) {
- $self->pidl("if ($length > $high) {");
- } else {
- $self->pidl("if ($length < $low || $length > $high) {");
- }
- $self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_RANGE, \"value out of range\");");
- $self->pidl("}");
- }
-
$var_name = get_array_element($var_name, $counter);
$self->ParseMemCtxPullStart($e, $l, $ndr, $array_name);
$var_name = get_array_element($var_name, $counter);
$self->ParseMemCtxPullStart($e, $l, $ndr, $array_name);