summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-06-11 08:54:11 +0200
committerStefan Metzmacher <metze@samba.org>2015-06-12 17:08:19 +0200
commit781cc3d50f18e69bad5faf67ee46f7b1fd28cf2a (patch)
tree2279c3df32a19ee360b8f83b3b5c3b580d115ca5 /pidl/lib/Parse
parentad7148fec650c10fa77daf73ece57a8dfa37eb63 (diff)
downloadsamba-781cc3d50f18e69bad5faf67ee46f7b1fd28cf2a.tar.gz
pidl:Python: protect for loops against $length being an expression instead of a scalar variable
This changes for (value_cntr_1 = 0; value_cntr_1 < r->out.length?*r->out.length:0; value_cntr_1++) { into: for (value_cntr_1 = 0; value_cntr_1 < (r->out.length?*r->out.length:0); value_cntr_1++) { it fixes a possible endless loop resulting in a crash. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'pidl/lib/Parse')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 1d271bfa525..b0a7099f1cf 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -1349,7 +1349,7 @@ sub ConvertObjectToPythonLevel($$$$$$)
$self->indent;
my $counter = "$e->{NAME}_cntr_$l->{LEVEL_INDEX}";
$self->pidl("int $counter;");
- $self->pidl("for ($counter = 0; $counter < $length; $counter++) {");
+ $self->pidl("for ($counter = 0; $counter < ($length); $counter++) {");
$self->indent;
my $member_var = "py_$e->{NAME}_$l->{LEVEL_INDEX}";
$self->pidl("PyObject *$member_var;");