From 7c34c05c6c40c1349cbccbcb04fa88fa006db613 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 3 May 2016 15:39:37 +0200 Subject: define new constant for max second factor length --- bin/ykfde.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/ykfde.c b/bin/ykfde.c index 21e7bea..2f1e73a 100644 --- a/bin/ykfde.c +++ b/bin/ykfde.c @@ -43,6 +43,7 @@ #define CHALLENGELEN SHA1_MAX_BLOCK_SIZE #define RESPONSELEN SHA1_MAX_BLOCK_SIZE #define PASSPHRASELEN SHA1_DIGEST_SIZE * 2 +#define MAX2FLEN CHALLENGELEN / 2 const static char optstring[] = "hn:s:V"; const static struct option options_long[] = { @@ -229,7 +230,7 @@ int main(int argc, char **argv) { * add second factor to new challenge */ tmp = new_2nd_factor ? new_2nd_factor : payload; plen = strlen(tmp); - memcpy(challenge_new, tmp, plen < CHALLENGELEN / 2 ? plen : CHALLENGELEN / 2); + memcpy(challenge_new, tmp, plen < MAX2FLEN ? plen : MAX2FLEN); /* do challenge/response and encode to hex */ if ((rc = yk_challenge_response(yk, yk_slot, true, @@ -278,7 +279,7 @@ int main(int argc, char **argv) { /* copy the second factor */ plen = strlen(payload); - memcpy(challenge_old, payload, plen < CHALLENGELEN / 2 ? plen : CHALLENGELEN / 2); + memcpy(challenge_old, payload, plen < MAX2FLEN ? plen : MAX2FLEN); /* do challenge/response and encode to hex */ if ((rc = yk_challenge_response(yk, yk_slot, true, -- cgit v1.2.3-70-g09d2