commit 7fae1d658a0ddb6a2ce3e5a5245291524bae9610
parent 727a1f8724ce338bec2f32e2cd97323694f1d1b4
Author: Evgeny Grin <k2k@drgrin.dev>
Date: Sat, 3 May 2025 14:21:51 +0300
Fixed non-const aggregate initialisation
Diffstat:
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/mhd2/post_parser_funcs.c b/src/mhd2/post_parser_funcs.c
@@ -233,8 +233,10 @@ detect_post_enc (struct MHD_Connection *restrict c)
if (1)
{
static const struct MHD_String txt_tkn = mhd_MSTR_INIT ("text/plain");
- struct MHD_String h_cnt_tp_copy = {h_cnt_tp->len, h_cnt_tp->cstr};
+ struct MHD_String h_cnt_tp_copy;
mhd_assert (NULL != h_cnt_tp->cstr);
+ h_cnt_tp_copy.len = h_cnt_tp->len;
+ h_cnt_tp_copy.cstr = h_cnt_tp->cstr;
if (mhd_str_starts_with_token_opt_param (&h_cnt_tp_copy,
&txt_tkn))
diff --git a/src/mhd2/response_auth_digest.c b/src/mhd2/response_auth_digest.c
@@ -379,15 +379,26 @@ response_add_auth_digest_challenge_int (struct MHD_Response *restrict response,
enum MHD_Bool userhash_support,
enum MHD_Bool prefer_utf8)
{
- const struct MHD_String rlm = { strlen (realm), realm };
- const struct MHD_StringNullable opq =
- { (NULL != opaque ? strlen (opaque) : 0), opaque };
- const struct MHD_StringNullable dmn =
- { (NULL != domain ? strlen (domain) : 0), domain };
+ struct MHD_String rlm;
+ struct MHD_StringNullable opq = {0, NULL };
+ struct MHD_StringNullable dmn = {0, NULL};
const bool qop_none =
(0 != (MHD_DIGEST_AUTH_QOP_NONE & ((unsigned int) mqop)));
enum MHD_StatusCode res;
+ rlm.len = strlen (realm);
+ rlm.cstr = realm;
+ if (NULL != opaque)
+ {
+ opq.len = strlen (opaque);
+ opq.cstr = opaque;
+ }
+ if (NULL != domain)
+ {
+ dmn.len = strlen (domain);
+ dmn.cstr = domain;
+ }
+
/* Check validity of the input data */
if (0 == rlm.len)