From 3fb27417295110cc812754508be21b0f478c43c3 Mon Sep 17 00:00:00 2001 From: mlelstv Date: Sat, 9 Mar 2024 13:48:50 +0000 Subject: [PATCH] Don't use uninitialized variable. Fixes PR 57895. --- lib/libcrypt/crypt-argon2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libcrypt/crypt-argon2.c b/lib/libcrypt/crypt-argon2.c index 6ade704d5a48..e009d75c66ac 100644 --- a/lib/libcrypt/crypt-argon2.c +++ b/lib/libcrypt/crypt-argon2.c @@ -207,7 +207,7 @@ estimate_argon2_params(argon2_type atype, uint32_t *etime, if (clock_gettime(CLOCK_MONOTONIC, &tp1) == -1) goto error; - for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) { + for (; time < ARGON2_MAX_TIME; ++time) { if (argon2_hash(time, memory, threads, tmp_pwd, sizeof(tmp_pwd), tmp_salt, sizeof(tmp_salt), @@ -221,6 +221,8 @@ estimate_argon2_params(argon2_type atype, uint32_t *etime, if (timespeccmp(&tp1, &tp2, >)) break; /* broken system... */ timespecsub(&tp2, &tp1, &delta); + if (delta.tv_sec >= 1) + break; } } else { time = *etime;