From: Richard Godbee Date: Sun, 21 Sep 2014 06:14:11 +0000 (-0400) Subject: BIO_debug_callback: Fix output on 64-bit machines X-Git-Tag: OpenSSL_1_0_2a~43 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5a9e9669d8073ddc5efeea08f3daee42509b2aa7;p=oweals%2Fopenssl.git BIO_debug_callback: Fix output on 64-bit machines BIO_debug_callback() no longer assumes the hexadecimal representation of a pointer fits in 8 characters. Signed-off-by: Richard Levitte Reviewed-by: Matt Caswell (cherry picked from commit 460e920d8a274e27aab36346eeda6685a42c3314) --- diff --git a/crypto/bio/bio_cb.c b/crypto/bio/bio_cb.c index 8715f5cbcb..d3e860686c 100644 --- a/crypto/bio/bio_cb.c +++ b/crypto/bio/bio_cb.c @@ -70,14 +70,17 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp, MS_STATIC char buf[256]; char *p; long r = 1; + int len; size_t p_maxlen; if (BIO_CB_RETURN & cmd) r = ret; - BIO_snprintf(buf, sizeof buf, "BIO[%08lX]:", (unsigned long)bio); - p = &(buf[14]); - p_maxlen = sizeof buf - 14; + len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio); + + p = buf + len; + p_maxlen = sizeof(buf) - len; + switch (cmd) { case BIO_CB_FREE: BIO_snprintf(p, p_maxlen, "Free - %s\n", bio->method->name);