Skip to content

Commit 272fc79

Browse files
RaisinTencodebytere
authored andcommitted
crypto: fix format warning in AdditionalConfig
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]>
1 parent 27f1bc0 commit 272fc79

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/crypto/crypto_keygen.cc

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "allocated_buffer-inl.h"
33
#include "async_wrap-inl.h"
44
#include "base_object-inl.h"
5+
#include "debug_utils-inl.h"
56
#include "env-inl.h"
67
#include "memory_tracker-inl.h"
78
#include "threadpoolwork-inl.h"
@@ -67,11 +68,11 @@ Maybe<bool> SecretKeyGenTraits::AdditionalConfig(
6768
CHECK(args[*offset]->IsUint32());
6869
params->length = std::trunc(args[*offset].As<Uint32>()->Value() / CHAR_BIT);
6970
if (params->length > INT_MAX) {
70-
char msg[1024];
71-
snprintf(msg, sizeof(msg),
72-
"length must be less than or equal to %lu bits",
73-
static_cast<size_t>(INT_MAX) * CHAR_BIT);
74-
THROW_ERR_OUT_OF_RANGE(env, msg);
71+
const std::string msg{
72+
SPrintF("length must be less than or equal to %s bits",
73+
static_cast<uint64_t>(INT_MAX) * CHAR_BIT)
74+
};
75+
THROW_ERR_OUT_OF_RANGE(env, msg.c_str());
7576
return Nothing<bool>();
7677
}
7778
*offset += 1;

0 commit comments

Comments
 (0)