summaryrefslogtreecommitdiff
path: root/source4/pidl/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-04-26 00:08:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:27 -0500
commit0263ec1c894c46a479b472d65dc5f3ce48c57673 (patch)
tree52821da85d787b7b227d832e75f8ab13414f09e9 /source4/pidl/lib
parent7a9076cba2de14b4cd82207efb81950639a2f266 (diff)
downloadsamba-0263ec1c894c46a479b472d65dc5f3ce48c57673.tar.gz
samba-0263ec1c894c46a479b472d65dc5f3ce48c57673.tar.bz2
samba-0263ec1c894c46a479b472d65dc5f3ce48c57673.zip
r15260: Don't dereference NULL pointers to obtain array lengths - found by
the IBM checker (This used to be commit a492cd4bd49b6922d91d4ce5f1247bad0d0d6a7e)
Diffstat (limited to 'source4/pidl/lib')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 550499a5f3..b9d8a1251c 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -117,6 +117,18 @@ sub get_value_of($)
}
#####################################################################
+# check that a variable we get from ParseExpr isn't a null pointer
+sub check_null_pointer($)
+{
+ my $size = shift;
+ if ($size =~ /^\*/) {
+ my $size2 = substr($size, 1);
+ pidl "if ($size2 == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;";
+ }
+}
+
+
+#####################################################################
# work out is a parse function should be declared static or not
sub fn_declare($$)
{
@@ -196,6 +208,7 @@ sub EjsPullArray($$$$$)
if (!$l->{IS_FIXED}) {
pidl "EJS_ALLOC_N(ejs, $var, $size);";
}
+ check_null_pointer($length);
pidl "ejs_pull_array_uint8(ejs, v, $name, $var, $length);";
return;
}
@@ -492,6 +505,7 @@ sub EjsPushArray($$$$$)
}
# uint8 arrays are treated as data blobs
if ($nl->{TYPE} eq 'DATA' && $e->{TYPE} eq 'uint8') {
+ check_null_pointer($length);
pidl "ejs_push_array_uint8(ejs, v, $name, $var, $length);";
return;
}