3785. [bug] Debugging code dumphex didn't accept arbitarily long

input (only compiled with -DDEBUG). [RT #35544]
This commit is contained in:
Mark Andrews 2014-03-13 12:37:07 +11:00
parent e9a9bb6b14
commit 3911e7610f
3 changed files with 37 additions and 16 deletions

View file

@ -1,3 +1,6 @@
3785. [bug] Debugging code dumphex didn't accept arbitarily long
input (only compiled with -DDEBUG). [RT #35544]
3784. [bug] Using "rrset-order fixed" when it had not been
enabled at compile time caused inconsistent
results. It now works as documented, defaulting

View file

@ -306,16 +306,25 @@ static void printnodename(dns_rbtnode_t *node);
static void
hexdump(const char *desc, unsigned char *data, size_t size) {
char hexdump[BUFSIZ];
char hexdump[BUFSIZ * 2 + 1];
isc_buffer_t b;
isc_region_t r;
isc_result_t result;
size_t bytes;
isc_buffer_init(&b, hexdump, sizeof(hexdump));
r.base = data;
r.length = size;
isc_hex_totext(&r, 0, "", &b);
isc_buffer_putuint8(&b, 0);
fprintf(stderr, "%s: %s\n", desc, hexdump);
fprintf(stderr, "%s: ", desc);
do {
isc_buffer_init(&b, hexdump, sizeof(hexdump));
r.base = data;
r.length = bytes = (size > BUFSIZ) ? BUFSIZ : size;
result = isc_hex_totext(&r, 0, "", &b);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
isc_buffer_putuint8(&b, 0);
fprintf(stderr, "%s", hexdump);
data += bytes;
size -= bytes;
} while (size > 0);
fprintf(stderr, "\n");
}
#endif
@ -644,7 +653,7 @@ dns_rbt_serialize_tree(FILE *file, dns_rbt_t *rbt,
isc_crc64_final(&crc);
#ifdef DEBUG
hexdump("serializing CRC", &crc, sizeof(crc));
hexdump("serializing CRC", (unsigned char *)&crc, sizeof(crc));
#endif
/* Serialize header */
@ -839,7 +848,7 @@ dns_rbt_deserialize_tree(void *base_address, size_t filesize,
isc_crc64_final(&crc);
#ifdef DEBUG
hexdump("deserializing CRC", &crc, sizeof(crc));
hexdump("deserializing CRC", (unsigned char *)&crc, sizeof(crc));
#endif
/* Check file hash */

View file

@ -748,16 +748,25 @@ static unsigned int init_count;
#ifdef DEBUG
static void
hexdump(const char *desc, unsigned char *data, size_t size) {
char hexdump[BUFSIZ];
char hexdump[BUFSIZ * 2 + 1];
isc_buffer_t b;
isc_region_t r;
isc_result_t result;
size_t bytes;
isc_buffer_init(&b, hexdump, sizeof(hexdump));
r.base = data;
r.length = size;
isc_hex_totext(&r, 0, "", &b);
isc_buffer_putuint8(&b, 0);
fprintf(stderr, "%s: %s\n", desc, hexdump);
fprintf(stderr, "%s: ", desc);
do {
isc_buffer_init(&b, hexdump, sizeof(hexdump));
r.base = data;
r.length = bytes = (size > BUFSIZ) ? BUFSIZ : size;
result = isc_hex_totext(&r, 0, "", &b);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
isc_buffer_putuint8(&b, 0);
fprintf(stderr, "%s", hexdump);
data += bytes;
size -= bytes;
} while (size > 0);
fprintf(stderr, "\n");
}
#endif