From: Aki Tuomi Date: Thu, 13 Aug 2020 08:41:23 +0000 (+0300) Subject: lib-otp: Use for-loop instead while X-Git-Tag: 2.3.13~211 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91c831378afa97388740975a8035c4c1af39091c;p=thirdparty%2Fdovecot%2Fcore.git lib-otp: Use for-loop instead while Avoids unsigned integer wrap --- diff --git a/src/lib-otp/otp-hash.c b/src/lib-otp/otp-hash.c index 0ad90bece4..c1b6f72c2b 100644 --- a/src/lib-otp/otp-hash.c +++ b/src/lib-otp/otp-hash.c @@ -147,7 +147,7 @@ void otp_hash(unsigned int algo, const char *seed, const char *passphrase, digest_update(&ctx, passphrase, strlen(passphrase)); digest_otp_final(&ctx, result); - while (step-- > 0) { + for (unsigned int i = 0; i < step; i++) { digest_init(&ctx, algo); digest_update(&ctx, result, OTP_HASH_SIZE); digest_otp_final(&ctx, result);