diff --git a/pamu2fcfg/pamu2fcfg.c b/pamu2fcfg/pamu2fcfg.c index 74d6ab4..cbc30a6 100644 --- a/pamu2fcfg/pamu2fcfg.c +++ b/pamu2fcfg/pamu2fcfg.c @@ -467,13 +467,13 @@ int main(int argc, char *argv[]) { parse_args(argc, argv, &args); fido_init(args.debug ? FIDO_DEBUG : 0); - devlist = fido_dev_info_new(64); + devlist = fido_dev_info_new(DEVLIST_LEN); if (!devlist) { fprintf(stderr, "error: fido_dev_info_new failed\n"); goto err; } - r = fido_dev_info_manifest(devlist, 64, &ndevs); + r = fido_dev_info_manifest(devlist, DEVLIST_LEN, &ndevs); if (r != FIDO_OK) { fprintf(stderr, "Unable to discover device(s), %s (%d)\n", fido_strerr(r), r); @@ -489,7 +489,7 @@ int main(int argc, char *argv[]) { fflush(stderr); sleep(FREQUENCY); - r = fido_dev_info_manifest(devlist, 64, &ndevs); + r = fido_dev_info_manifest(devlist, DEVLIST_LEN, &ndevs); if (r != FIDO_OK) { fprintf(stderr, "\nUnable to discover device(s), %s (%d)", fido_strerr(r), r); diff --git a/util.c b/util.c index f3ea20f..10476b2 100644 --- a/util.c +++ b/util.c @@ -1155,13 +1155,13 @@ int do_authentication(const cfg_t *cfg, const device_t *devices, #endif memset(&pk, 0, sizeof(pk)); - devlist = fido_dev_info_new(64); + devlist = fido_dev_info_new(DEVLIST_LEN); if (!devlist) { debug_dbg(cfg, "Unable to allocate devlist"); goto out; } - r = fido_dev_info_manifest(devlist, 64, &ndevs); + r = fido_dev_info_manifest(devlist, DEVLIST_LEN, &ndevs); if (r != FIDO_OK) { debug_dbg(cfg, "Unable to discover device(s), %s (%d)", fido_strerr(r), r); goto out; @@ -1171,7 +1171,7 @@ int do_authentication(const cfg_t *cfg, const device_t *devices, debug_dbg(cfg, "Device max index is %zu", ndevs); - authlist = calloc(64 + 1, sizeof(fido_dev_t *)); + authlist = calloc(DEVLIST_LEN + 1, sizeof(fido_dev_t *)); if (!authlist) { debug_dbg(cfg, "Unable to allocate authenticator list"); goto out; @@ -1267,13 +1267,13 @@ int do_authentication(const cfg_t *cfg, const device_t *devices, fido_dev_info_free(&devlist, ndevs); - devlist = fido_dev_info_new(64); + devlist = fido_dev_info_new(DEVLIST_LEN); if (!devlist) { debug_dbg(cfg, "Unable to allocate devlist"); goto out; } - r = fido_dev_info_manifest(devlist, 64, &ndevs); + r = fido_dev_info_manifest(devlist, DEVLIST_LEN, &ndevs); if (r != FIDO_OK) { debug_dbg(cfg, "Unable to discover device(s), %s (%d)", fido_strerr(r), r); diff --git a/util.h b/util.h index cb8572b..f3dac94 100644 --- a/util.h +++ b/util.h @@ -21,6 +21,8 @@ #define DEFAULT_ORIGIN_PREFIX "pam://" #define SSH_ORIGIN "ssh:" +#define DEVLIST_LEN 64 + typedef struct { unsigned max_devs; int manual;