summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-16 16:57:21 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-16 21:09:17 +1000
commit83a24ff2efd48b0e192024798695f6cfec9000b5 (patch)
treef3c3e9d54a4e5921a9a0310b1454896f7512aa21 /pidl/lib/Parse/Pidl
parent14340a45bef921db19581258838ec2371d4d21e9 (diff)
downloadsamba-83a24ff2efd48b0e192024798695f6cfec9000b5.tar.gz
samba-83a24ff2efd48b0e192024798695f6cfec9000b5.tar.bz2
samba-83a24ff2efd48b0e192024798695f6cfec9000b5.zip
pidl: prevent ndr_print_*() dying on NULL pointers
when using ndrdump you can get uninitialised structures containing pointers. Don't segfault when trying to print them
Diffstat (limited to 'pidl/lib/Parse/Pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 83bca288ed..b389cfbc13 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1466,6 +1466,7 @@ sub ParseStructPrint($$$$$)
$self->DeclareArrayVariables($_) foreach (@{$struct->{ELEMENTS}});
$self->pidl("ndr_print_struct($ndr, name, \"$name\");");
+ $self->pidl("if (r == NULL) { ndr_print_null($ndr); return; }");
$self->start_flags($struct, $ndr);
@@ -2039,6 +2040,7 @@ sub ParseFunctionPrint($$)
}
$self->pidl("ndr_print_struct($ndr, name, \"$fn->{NAME}\");");
+ $self->pidl("if (r == NULL) { ndr_print_null($ndr); return; }");
$self->pidl("$ndr->depth++;");
$self->pidl("if (flags & NDR_SET_VALUES) {");