From 6496fab3b6a6bd6b53d8c4c9b4151c6d81dd2f85 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 14 Feb 2007 13:24:37 +0000 Subject: [PATCH] r21334: compare the original buffer and the validated one byte by byte and print out the first mismatch metze (This used to be commit 6ac574660a0656341d7a311738d20b328f31ff78) --- source4/utils/ndrdump.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/source4/utils/ndrdump.c b/source4/utils/ndrdump.c index 9e224c8137e..affdc60b4a5 100644 --- a/source4/utils/ndrdump.c +++ b/source4/utils/ndrdump.c @@ -329,6 +329,9 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin, struct ndr_push *ndr_v_push; struct ndr_pull *ndr_v_pull; struct ndr_print *ndr_v_print; + uint32_t i; + uint8_t byte_a, byte_b; + bool differ; ndr_v_push = ndr_push_init_ctx(mem_ctx); @@ -367,11 +370,36 @@ const struct dcerpc_interface_table *load_iface_from_plugin(const char *plugin, f->ndr_print(ndr_v_print, function, flags, v_st); if (blob.length != v_blob.length) { - printf("WARNING! orig bytes:%ld validated pushed bytes:%ld\n", (long)blob.length, (long)v_blob.length); + printf("WARNING! orig bytes:%u validated pushed bytes:%u\n", blob.length, v_blob.length); } if (ndr_pull->offset != ndr_v_pull->offset) { - printf("WARNING! orig pulled bytes:%d validated pulled bytes:%d\n", ndr_pull->offset, ndr_v_pull->offset); + printf("WARNING! orig pulled bytes:%u validated pulled bytes:%u\n", ndr_pull->offset, ndr_v_pull->offset); + } + + differ = false; + byte_a = 0x00; + byte_b = 0x00; + for (i=0; i < blob.length; i++) { + byte_a = blob.data[i]; + + if (i == v_blob.length) { + byte_b = 0x00; + differ = true; + break; + } + + byte_b = v_blob.data[i]; + + if (byte_a != byte_b) { + differ = true; + break; + } + } + if (differ) { + printf("WARNING! orig and validated differ at byte 0x%02X (%u)\n", i, i); + printf("WARNING! orig byte[0x%02X] = 0x%02X validated byte[0x%02X] = 0x%02X\n", + i, byte_a, i, byte_b); } } -- 2.11.4.GIT