Skip to content

Commit

Permalink
util: fix cppcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dacav committed Jan 16, 2025
1 parent 79349bf commit c4bb264
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ static int parse_native_format(const cfg_t *cfg, const char *username,
FILE *opwfile, device_t *devices,
unsigned *n_devs) {

char *s_user, *s_credential;
char *buf = NULL;
const char *s_user;
char *buf = NULL, *s_credential;
size_t bufsiz = 0;
ssize_t len;
unsigned i;
Expand Down Expand Up @@ -786,7 +786,6 @@ void free_devices(device_t *devices, const unsigned n_devs) {
}

free(devices);
devices = NULL;
}

static int get_authenticators(const cfg_t *cfg, const fido_dev_info_t *devlist,
Expand Down Expand Up @@ -885,13 +884,14 @@ static void parse_opts(const cfg_t *cfg, const char *attr, struct opts *opts) {

static int get_device_opts(fido_dev_t *dev, int *pin, int *uv) {
fido_cbor_info_t *info = NULL;
char *const *ptr;
const bool *val;
size_t len;

*pin = *uv = -1; /* unsupported */

if (fido_dev_is_fido2(dev)) {
char *const *ptr;
size_t len;

if ((info = fido_cbor_info_new()) == NULL ||
fido_dev_get_cbor_info(dev, info) != FIDO_OK) {
fido_cbor_info_free(&info);
Expand Down 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 c4bb264

Please sign in to comment.