digestauth: simplified overflow check

This commit is contained in:
Evgeny Grin (Karlson2k)
2022-05-16 19:46:29 +03:00
parent 6c3d5864df
commit 393c5a451c
+1 -1
View File
@@ -671,7 +671,7 @@ check_nonce_nc (struct MHD_Connection *connection,
mod = daemon->nonce_nc_size;
if (0 == mod)
return MHD_DAUTH_NONCENC_STALE; /* no array! */
if (nc + 64 < nc)
if (nc >= UINT64_MAX - 64)
return MHD_DAUTH_NONCENC_STALE; /* Overflow, unrealistically high value */
nn = &daemon->nnc[get_nonce_nc_idx (mod, nonce, noncelen)];