diff --git a/src/microhttpd/basicauth.h b/src/microhttpd/basicauth.h index c46fe27a..e0bbeec5 100644 --- a/src/microhttpd/basicauth.h +++ b/src/microhttpd/basicauth.h @@ -37,7 +37,7 @@ struct MHD_RqBAuth { - struct _MHD_cstr_w_len token68; + struct _MHD_str_w_len token68; }; #endif /* ! MHD_BASICAUTH_H */ diff --git a/src/microhttpd/digestauth.h b/src/microhttpd/digestauth.h index 77c7c402..367e8e01 100644 --- a/src/microhttpd/digestauth.h +++ b/src/microhttpd/digestauth.h @@ -51,7 +51,7 @@ struct MHD_RqDAuthParam { - struct _MHD_cstr_w_len value; + struct _MHD_str_w_len value; bool quoted; }; diff --git a/src/microhttpd/gen_auth.c b/src/microhttpd/gen_auth.c index 2cdfb3d3..67bd9dc6 100644 --- a/src/microhttpd/gen_auth.c +++ b/src/microhttpd/gen_auth.c @@ -91,8 +91,8 @@ parse_bauth_params (const char *str, else { /* No more data in the string, only single token68. */ - const struct _MHD_cstr_w_len tkn = { str + token68_start, token68_len}; - memcpy (&pbauth->token68, &tkn, sizeof(tkn)); + pbauth->token68.str = str + token68_start; + pbauth->token68.len = token68_len; } } return true; @@ -251,11 +251,8 @@ parse_dauth_params (const char *str, /* Have valid parameter name and value */ mhd_assert (! quoted || 0 != value_len); - if (1) - { - const struct _MHD_cstr_w_len val = {str + value_start, value_len}; - memcpy (&aparam->param->value, &val, sizeof(val)); - } + aparam->param->value.str = str + value_start; + aparam->param->value.len = value_len; aparam->param->quoted = quoted; break; /* Found matching parameter name */ diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h index 7cf827ab..67b2d044 100644 --- a/src/microhttpd/mhd_str.h +++ b/src/microhttpd/mhd_str.h @@ -63,6 +63,15 @@ struct _MHD_cstr_w_len const size_t len; }; +/** + * String with length + */ +struct _MHD_str_w_len +{ + const char *str; + size_t len; +}; + /** * Static string initialiser for struct _MHD_str_w_len */