ndrdump: Fix a possible NULL pointer dereference
authorAndreas Schneider <asn@samba.org>
Thu, 16 Feb 2017 16:34:07 +0000 (17:34 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 23 Feb 2017 02:18:10 +0000 (03:18 +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>
librpc/tools/ndrdump.c

index b1e96b8a84232131d1e1f109fa1e427cae25b848..e26d371942985e4f85939097559c204e39f066d9 100644 (file)
@@ -502,6 +502,10 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
                bool differ;
 
                ndr_v_push = ndr_push_init_ctx(mem_ctx);
                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;
 
                if (assume_ndr64) {
                        ndr_v_push->flags |= LIBNDR_FLAG_NDR64;