diff options
author | Alex Newman <posix4e@gmail.com> | 2016-12-01 15:22:25 -0800 |
---|---|---|
committer | Myles Borins <myles.borins@gmail.com> | 2016-12-16 14:34:19 -0500 |
commit | 40eba1270aa97ec0ce5d545ad3dd41aec25cd3da (patch) | |
tree | 3f944b81811f3c8eed5ce25986eaba8b6d69653f /src | |
parent | 885c80f3de0e73e9646087cacbfb82d3c25bf8ab (diff) | |
download | android-node-v8-40eba1270aa97ec0ce5d545ad3dd41aec25cd3da.tar.gz android-node-v8-40eba1270aa97ec0ce5d545ad3dd41aec25cd3da.tar.bz2 android-node-v8-40eba1270aa97ec0ce5d545ad3dd41aec25cd3da.zip |
src: fix string format mistake for 32 bit node
warning: format ‘%lx’ expects argument of type ‘long
unsigned int’, but argument 3 has type ‘unsigned int’ [-Wformat=]
BIO_printf(bio, "0x%lx", exponent_word);
PR-URL: https://github.com/nodejs/node/pull/10082
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_crypto.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 8f2f75048f..abfa8c585f 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1536,9 +1536,14 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) { String::kNormalString, mem->length)); (void) BIO_reset(bio); - BN_ULONG exponent_word = BN_get_word(rsa->e); - BIO_printf(bio, "0x%lx", exponent_word); - + uint64_t exponent_word = static_cast<uint64_t>(BN_get_word(rsa->e)); + uint32_t lo = static_cast<uint32_t>(exponent_word); + uint32_t hi = static_cast<uint32_t>(exponent_word >> 32); + if (hi == 0) { + BIO_printf(bio, "0x%x", lo); + } else { + BIO_printf(bio, "0x%x%08x", hi, lo); + } BIO_get_mem_ptr(bio, &mem); info->Set(env->exponent_string(), String::NewFromUtf8(env->isolate(), mem->data, |