Skip to content

Commit

Permalink
util: cppcheck(1) fix
Browse files Browse the repository at this point in the history
According to cppcheck(1) the two snprintf should use %u for unsigned integer
variables.
  • Loading branch information
dacav committed Jan 16, 2025
1 parent 0a9bc05 commit 9774618
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ int do_manual_authentication(const cfg_t *cfg, const device_t *devices,

debug_dbg(cfg, "Challenge: %s", b64_challenge);

n = snprintf(prompt, sizeof(prompt), "Challenge #%d:", i + 1);
n = snprintf(prompt, sizeof(prompt), "Challenge #%u:", i + 1);
if (n <= 0 || (size_t) n >= sizeof(prompt)) {
debug_dbg(cfg, "Failed to print challenge prompt");
goto out;
Expand All @@ -1449,7 +1449,7 @@ int do_manual_authentication(const cfg_t *cfg, const device_t *devices,
"paste the results in the prompt below.");

for (i = 0; i < n_devs; ++i) {
n = snprintf(prompt, sizeof(prompt), "Response #%d: ", i + 1);
n = snprintf(prompt, sizeof(prompt), "Response #%u: ", i + 1);
if (n <= 0 || (size_t) n >= sizeof(prompt)) {
debug_dbg(cfg, "Failed to print response prompt");
goto out;
Expand Down

0 comments on commit 9774618

Please sign in to comment.