diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-06 11:57:54 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-05-06 11:57:54 +0300 |
commit | c55939891de165bfdd8bd022d64f1170ecc38247 (patch) | |
tree | 9f5ab6f3655c6c6aaddf64bcc7f929e57f5a908d /src/microhttpd/digestauth.c | |
parent | 05a79fdb36600236bb52b9a7830e627fa3c5e9ca (diff) | |
download | libmicrohttpd-c55939891de165bfdd8bd022d64f1170ecc38247.tar.gz libmicrohttpd-c55939891de165bfdd8bd022d64f1170ecc38247.zip |
digestauth: added two more asserts
Diffstat (limited to 'src/microhttpd/digestauth.c')
-rw-r--r-- | src/microhttpd/digestauth.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index ecc29ff1..11512db0 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -569,6 +569,7 @@ get_nonce_nc_idx (size_t arr_size, | |||
569 | size_t noncelen) | 569 | size_t noncelen) |
570 | { | 570 | { |
571 | mhd_assert (0 != arr_size); | 571 | mhd_assert (0 != arr_size); |
572 | mhd_assert (0 != noncelen); | ||
572 | return fast_simple_hash ((const uint8_t *) nonce, noncelen) % arr_size; | 573 | return fast_simple_hash ((const uint8_t *) nonce, noncelen) % arr_size; |
573 | } | 574 | } |
574 | 575 | ||
@@ -982,7 +983,7 @@ calculate_add_nonce_with_retry (struct MHD_Connection *const connection, | |||
982 | base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3); | 983 | base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3); |
983 | base1 = (uint64_t) (uintptr_t) connection; | 984 | base1 = (uint64_t) (uintptr_t) connection; |
984 | base2 = ((uint32_t) (base1 >> 32)) ^ ((uint32_t) base1); | 985 | base2 = ((uint32_t) (base1 >> 32)) ^ ((uint32_t) base1); |
985 | base2 = _MHD_ROTL32 (base2, (((base1 >> 4) ^ base1) % 32)); | 986 | base2 = _MHD_ROTL32 (base2, (((base4 >> 4) ^ base4) % 32)); |
986 | base3 = ((uint16_t) (base2 >> 16)) ^ ((uint16_t) base2); | 987 | base3 = ((uint16_t) (base2 >> 16)) ^ ((uint16_t) base2); |
987 | base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3); | 988 | base4 = ((uint8_t) (base3 >> 8)) ^ ((uint8_t) base3); |
988 | timestamp2 -= (base4 & 0x7f); /* Use up to 127 ms difference */ | 989 | timestamp2 -= (base4 & 0x7f); /* Use up to 127 ms difference */ |
@@ -995,7 +996,8 @@ calculate_add_nonce_with_retry (struct MHD_Connection *const connection, | |||
995 | * so client should re-try automatically. */ | 996 | * so client should re-try automatically. */ |
996 | return false; | 997 | return false; |
997 | } | 998 | } |
998 | memcpy (nonce, nonce2, NONCE_STD_LEN (digest_size) + 1); | 999 | memcpy (nonce, nonce2, NONCE_STD_LEN (digest_size)); |
1000 | mhd_assert (0 == nonce[NONCE_STD_LEN (digest_size)]); | ||
999 | } | 1001 | } |
1000 | return true; | 1002 | return true; |
1001 | } | 1003 | } |