summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--librpc/ndr/libndr.h1
-rw-r--r--librpc/ndr/ndr_basic.c10
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm2
3 files changed, 13 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 9134efa174..5ad05be891 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -520,6 +520,7 @@ enum ndr_err_code ndr_push_unique_ptr(struct ndr_push *ndr, const void *p);
enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p);
enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr);
void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type);
+void ndr_print_null(struct ndr_print *ndr);
void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, const char *val, uint32_t value);
void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value);
void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value);
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 58d4e46e72..c27faa2398 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -854,6 +854,11 @@ _PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const ch
ndr->print(ndr, "%s: struct %s", name, type);
}
+_PUBLIC_ void ndr_print_null(struct ndr_print *ndr)
+{
+ ndr->print(ndr, "UNEXPECTED NULL POINTER");
+}
+
_PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type,
const char *val, uint32_t value)
{
@@ -1005,6 +1010,11 @@ _PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
{
int i;
+ if (data == NULL) {
+ ndr->print(ndr, "%s: ARRAY(%d) : NULL", name, count);
+ return;
+ }
+
if (count <= 600 && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
char s[1202];
for (i=0;i<count;i++) {
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) {");