diff options
-rw-r--r-- | src/microhttpd/digestauth.c | 12 |
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; |