Browse Source

[multiple] pass len when copying constant strings

master
Glenn Strauss 8 months ago
parent
commit
4863c9a63c
  1. 2
      src/mod_authn_gssapi.c
  2. 2
      src/mod_gnutls.c
  3. 4
      src/mod_mbedtls.c
  4. 2
      src/mod_nss.c
  5. 4
      src/mod_openssl.c
  6. 2
      src/mod_wolfssl.c

2
src/mod_authn_gssapi.c

@ -334,7 +334,7 @@ static handler_t mod_authn_gssapi_check_spnego(request_st * const r, plugin_data
/* ??? Should KRB5_KTNAME be added to mod_authn_gssapi_basic(), too? */
buffer ktname;
memset(&ktname, 0, sizeof(ktname));
buffer_copy_string(&ktname, "KRB5_KTNAME=");
buffer_copy_string_len(&ktname, CONST_STR_LEN("KRB5_KTNAME="));
buffer_append_string_buffer(&ktname, p->conf.auth_gssapi_keytab);
putenv(ktname.ptr);
/* ktname.ptr becomes part of the environment, do not free */

2
src/mod_gnutls.c

@ -1401,7 +1401,7 @@ mod_gnutls_SNI(handler_ctx * const hctx,
len -= 5;
servername += 5;
request_st * const r = hctx->r;
buffer_copy_string(&r->uri.scheme, "https");
buffer_copy_string_len(&r->uri.scheme, CONST_STR_LEN("https"));
if (len >= 1024) { /*(expecting < 256; TLSEXT_MAXLEN_host_name is 255)*/
log_error(r->conf.errh, __FILE__, __LINE__,

4
src/mod_mbedtls.c

@ -695,9 +695,9 @@ static int
mod_mbedtls_SNI (void *arg, mbedtls_ssl_context *ssl, const unsigned char *servername, size_t len)
{
handler_ctx * const hctx = (handler_ctx *) arg;
buffer_copy_string(&hctx->r->uri.scheme, "https");
request_st * const r = hctx->r;
buffer_copy_string_len(&r->uri.scheme, CONST_STR_LEN("https"));
if (len >= 1024) { /*(expecting < 256; TLSEXT_MAXLEN_host_name is 255)*/
log_error(r->conf.errh, __FILE__, __LINE__,
"MTLS: SNI name too long %.*s", (int)len, servername);

2
src/mod_nss.c

@ -1346,7 +1346,7 @@ mod_nss_SNI (PRFileDesc *ssl, const SECItem *srvNameArr, PRUint32 srvNameArrSize
handler_ctx * const hctx = (handler_ctx *)arg;
request_st * const r = hctx->r;
buffer_copy_string(&r->uri.scheme, "https");
buffer_copy_string_len(&r->uri.scheme, CONST_STR_LEN("https"));
PRUint32 i = 0; /* index into srvNameArr; always take first element */
const SECItem *sn = srvNameArr+i;

4
src/mod_openssl.c

@ -1211,7 +1211,7 @@ static int
mod_openssl_client_hello_cb (SSL *ssl, int *al, void *srv)
{
handler_ctx *hctx = (handler_ctx *) SSL_get_app_data(ssl);
buffer_copy_string(&hctx->r->uri.scheme, "https");
buffer_copy_string_len(&hctx->r->uri.scheme, CONST_STR_LEN("https"));
UNUSED(srv);
const unsigned char *name;
@ -1241,7 +1241,7 @@ static int
network_ssl_servername_callback (SSL *ssl, int *al, void *srv)
{
handler_ctx *hctx = (handler_ctx *) SSL_get_app_data(ssl);
buffer_copy_string(&hctx->r->uri.scheme, "https");
buffer_copy_string_len(&hctx->r->uri.scheme, CONST_STR_LEN("https"));
UNUSED(al);
UNUSED(srv);

2
src/mod_wolfssl.c

@ -1296,7 +1296,7 @@ network_ssl_servername_callback (SSL *ssl, int *al, void *srv)
#endif
if (hctx->r->conditional_is_valid & (1 << COMP_HTTP_HOST))/*(already done)*/
return SSL_TLSEXT_ERR_OK; /*(wolfSSL might call twice in client hello)*/
buffer_copy_string(&hctx->r->uri.scheme, "https");
buffer_copy_string_len(&hctx->r->uri.scheme, CONST_STR_LEN("https"));
UNUSED(al);
UNUSED(srv);

Loading…
Cancel
Save