[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 07/09: check_nonce_nc(): fixed missing set of the bit fo
From: |
gnunet |
Subject: |
[libmicrohttpd] 07/09: check_nonce_nc(): fixed missing set of the bit for the old 'nc' value |
Date: |
Sun, 01 May 2022 16:08:53 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit f473462465f0a4044fb8f37e1064dc08fb45fc17
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun May 1 16:44:53 2022 +0300
check_nonce_nc(): fixed missing set of the bit for the old 'nc' value
When 'nc' values are increased sequentially, the bit for the old 'nc'
value was not set.
---
src/microhttpd/digestauth.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 97f614a8..39496727 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -634,8 +634,16 @@ check_nonce_nc (struct MHD_Connection *connection,
else
{
/* 'nc' is larger, shift bitmask and bump limit */
- if (64 > nc - nn->nc)
- nn->nmask <<= (nc - nn->nc); /* small jump, less than mask width */
+ const uint64_t jump_size = nc - nn->nc;
+ if (64 > jump_size)
+ {
+ /* small jump, less than mask width */
+ nn->nmask <<= jump_size;
+ /* Set bit for the old 'nc' value */
+ nn->nmask |= (UINT64_C (1) << (jump_size - 1));
+ }
+ else if (64 == jump_size)
+ nn->nmask = (UINT64_C (1) << 63);
else
nn->nmask = 0; /* big jump, unset all bits in the mask */
nn->nc = nc;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (06336118 -> 76b68f65), gnunet, 2022/05/01
- [libmicrohttpd] 04/09: check_nonce_nc(): simplified, gnunet, 2022/05/01
- [libmicrohttpd] 01/09: microhttpd.h: fixed list of required types, gnunet, 2022/05/01
- [libmicrohttpd] 02/09: digestauth: when checking 'nc' reuse always check nonce match first, gnunet, 2022/05/01
- [libmicrohttpd] 03/09: struct MHD_NonceNc: improved doxy, gnunet, 2022/05/01
- [libmicrohttpd] 07/09: check_nonce_nc(): fixed missing set of the bit for the old 'nc' value,
gnunet <=
- [libmicrohttpd] 06/09: check_nonce_nc(): moved 'nc' overflow check out of mutex lock, gnunet, 2022/05/01
- [libmicrohttpd] 05/09: check_nonce_nc(): improved readability, fixed comments, gnunet, 2022/05/01
- [libmicrohttpd] 09/09: check_nonce_nc(): sorted checks according to probability, gnunet, 2022/05/01
- [libmicrohttpd] 08/09: check_nonce_nc(): additionally improved readability, fixed comments, gnunet, 2022/05/01