libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 1100fc7d314f1aa1938ff84f3dd0315e53cc1529
parent 26260f778cb98272ddce217286250f36bb5aef76
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun, 21 Dec 2025 17:32:27 +0100

mhd_const.c: fixed off-by-one for the string size

Diffstat:
Msrc/mhd2/mhd_const.c | 35+++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/mhd2/mhd_const.c b/src/mhd2/mhd_const.c @@ -44,21 +44,20 @@ #include "mhd_sys_options.h" +#include "mhd_str_macros.h" + #include "sys_null_macro.h" #include "mhd_public_api.h" -#define CONST_STR(s) \ - { sizeof (s), s } - MHD_EXTERN_ const struct MHD_String * MHD_protocol_version_to_string (enum MHD_HTTP_ProtocolVersion pv) { static const struct MHD_String results[] = { - CONST_STR ("invalid"), - CONST_STR ("HTTP/1.0"), - CONST_STR ("HTTP/1.2"), - CONST_STR ("HTTP/2"), - CONST_STR ("HTTP/3") + mhd_MSTR_INIT ("invalid"), + mhd_MSTR_INIT ("HTTP/1.0"), + mhd_MSTR_INIT ("HTTP/1.2"), + mhd_MSTR_INIT ("HTTP/2"), + mhd_MSTR_INIT ("HTTP/3") }; if ( (pv > 0) && @@ -72,16 +71,16 @@ MHD_EXTERN_ const struct MHD_String * MHD_http_method_to_string (enum MHD_HTTP_Method method) { static const struct MHD_String results[] = { - CONST_STR ("invalid"), - CONST_STR ("GET"), - CONST_STR ("HEAD"), - CONST_STR ("POST"), - CONST_STR ("PUT"), - CONST_STR ("DELETE"), - CONST_STR ("CONNECT"), - CONST_STR ("OPTIONS"), - CONST_STR ("TRACE"), - CONST_STR ("*") + mhd_MSTR_INIT ("invalid"), + mhd_MSTR_INIT ("GET"), + mhd_MSTR_INIT ("HEAD"), + mhd_MSTR_INIT ("POST"), + mhd_MSTR_INIT ("PUT"), + mhd_MSTR_INIT ("DELETE"), + mhd_MSTR_INIT ("CONNECT"), + mhd_MSTR_INIT ("OPTIONS"), + mhd_MSTR_INIT ("TRACE"), + mhd_MSTR_INIT ("*") }; if ( (method > 0) &&