summaryrefslogtreecommitdiff
path: root/librpc/ndr/ndr_basic.c
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 /librpc/ndr/ndr_basic.c
parent14340a45bef921db19581258838ec2371d4d21e9 (diff)
downloadsamba-83a24ff2efd48b0e192024798695f6cfec9000b5.tar.gz
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 'librpc/ndr/ndr_basic.c')
-rw-r--r--librpc/ndr/ndr_basic.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 58d4e46e72d..c27faa23981 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++) {