aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/digestauth.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-05-01 16:44:53 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-05-01 16:44:53 +0300
commitf473462465f0a4044fb8f37e1064dc08fb45fc17 (patch)
treed223562fa98fd9458dec29d99a73fd7f68b2be7b /src/microhttpd/digestauth.c
parent8457dfc7b6a643802accba03c09a7602922a63f1 (diff)
downloadlibmicrohttpd-f473462465f0a4044fb8f37e1064dc08fb45fc17.tar.gz
libmicrohttpd-f473462465f0a4044fb8f37e1064dc08fb45fc17.zip
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.
Diffstat (limited to 'src/microhttpd/digestauth.c')
-rw-r--r--src/microhttpd/digestauth.c12
1 files 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,
634 else 634 else
635 { 635 {
636 /* 'nc' is larger, shift bitmask and bump limit */ 636 /* 'nc' is larger, shift bitmask and bump limit */
637 if (64 > nc - nn->nc) 637 const uint64_t jump_size = nc - nn->nc;
638 nn->nmask <<= (nc - nn->nc); /* small jump, less than mask width */ 638 if (64 > jump_size)
639 {
640 /* small jump, less than mask width */
641 nn->nmask <<= jump_size;
642 /* Set bit for the old 'nc' value */
643 nn->nmask |= (UINT64_C (1) << (jump_size - 1));
644 }
645 else if (64 == jump_size)
646 nn->nmask = (UINT64_C (1) << 63);
639 else 647 else
640 nn->nmask = 0; /* big jump, unset all bits in the mask */ 648 nn->nmask = 0; /* big jump, unset all bits in the mask */
641 nn->nc = nc; 649 nn->nc = nc;