Skip to content

Commit

Permalink
crypto: fix format warning in AdditionalConfig
Browse files Browse the repository at this point in the history
Fixes warning: format ‘%lu’ expects argument of type ‘long unsigned
int’, but argument 4 has type ‘size_t {aka unsigned int}`

Co-authored-by: Anna Henningsen <[email protected]>

PR-URL: #36060
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
RaisinTen authored and codebytere committed Nov 22, 2020
1 parent 27f1bc0 commit 272fc79
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/crypto/crypto_keygen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "allocated_buffer-inl.h"
#include "async_wrap-inl.h"
#include "base_object-inl.h"
#include "debug_utils-inl.h"
#include "env-inl.h"
#include "memory_tracker-inl.h"
#include "threadpoolwork-inl.h"
Expand Down Expand Up @@ -67,11 +68,11 @@ Maybe<bool> SecretKeyGenTraits::AdditionalConfig(
CHECK(args[*offset]->IsUint32());
params->length = std::trunc(args[*offset].As<Uint32>()->Value() / CHAR_BIT);
if (params->length > INT_MAX) {
char msg[1024];
snprintf(msg, sizeof(msg),
"length must be less than or equal to %lu bits",
static_cast<size_t>(INT_MAX) * CHAR_BIT);
THROW_ERR_OUT_OF_RANGE(env, msg);
const std::string msg{
SPrintF("length must be less than or equal to %s bits",
static_cast<uint64_t>(INT_MAX) * CHAR_BIT)
};
THROW_ERR_OUT_OF_RANGE(env, msg.c_str());
return Nothing<bool>();
}
*offset += 1;
Expand Down

0 comments on commit 272fc79

Please sign in to comment.