From abe138ee3aaadea496fbdddd23d79fbe40113171 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 7 Jun 2022 20:23:18 +0300 Subject: Fixed wrong usage of maximum client nonce size as maximum size of server nonce This also saves some RAM for nonce-nc map array --- src/microhttpd/internal.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/microhttpd/internal.h') diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 4f03b8fc..92fa932b 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h @@ -240,8 +240,16 @@ enum MHD_ConnectionEventLoopInfo * (already) takes more (see Mantis #1633), so we've increased the * value to support something longer... */ -#define MAX_NONCE_LENGTH 129 +#define MAX_CLIENT_NONCE_LENGTH 129 +/** + * The maximum size of MHD-generated nonce when printed with hexadecimal chars. + * + * This is equal to "(32 bytes for SHA-256 nonce plus 6 bytes for timestamp) + * multiplied by two hex chars per byte". + * Please keep it in sync with digestauth.c + */ +#define MAX_DIGEST_NONCE_LENGTH ((32 + 6) * 2) /** * A structure representing the internal holder of the @@ -269,7 +277,7 @@ struct MHD_NonceNc /** * Nonce value: */ - char nonce[MAX_NONCE_LENGTH + 1]; + char nonce[MAX_DIGEST_NONCE_LENGTH + 1]; }; -- cgit v1.2.3