ndrdump: Fix a possible NULL pointer dereference
authorAndreas Schneider <asn@samba.org>
Thu, 16 Feb 2017 16:34:07 +0000 (17:34 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 2 Mar 2017 08:09:26 +0000 (09:09 +0100)
Found by covscan.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12592

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 79a49dc19a83bd22684a71aecf4588b753669039)

librpc/tools/ndrdump.c

index d534e3c1dbaa8ff203826760984071776f68cd04..d8b991606b016b30c5f5e6c950505b8a8e69622a 100644 (file)
@@ -493,6 +493,10 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
                bool differ;
 
                ndr_v_push = ndr_push_init_ctx(mem_ctx);
+               if (ndr_v_push == NULL) {
+                       printf("No memory\n");
+                       exit(1);
+               }
 
                if (assume_ndr64) {
                        ndr_v_push->flags |= LIBNDR_FLAG_NDR64;