summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s3_srvr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/s3_srvr.c')
-rw-r--r--src/lib/libssl/s3_srvr.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c
index 0794a298b1..f532e254f9 100644
--- a/src/lib/libssl/s3_srvr.c
+++ b/src/lib/libssl/s3_srvr.c
@@ -1574,6 +1574,9 @@ ssl3_send_server_key_exchange(SSL *s)
1574 BN_CTX *bn_ctx = NULL; 1574 BN_CTX *bn_ctx = NULL;
1575 1575
1576#endif 1576#endif
1577#ifndef OPENSSL_NO_PSK
1578 size_t pskhintlen;
1579#endif
1577 EVP_PKEY *pkey; 1580 EVP_PKEY *pkey;
1578 const EVP_MD *md = NULL; 1581 const EVP_MD *md = NULL;
1579 unsigned char *p, *d; 1582 unsigned char *p, *d;
@@ -1804,10 +1807,9 @@ ssl3_send_server_key_exchange(SSL *s)
1804#endif /* !OPENSSL_NO_ECDH */ 1807#endif /* !OPENSSL_NO_ECDH */
1805#ifndef OPENSSL_NO_PSK 1808#ifndef OPENSSL_NO_PSK
1806 if (type & SSL_kPSK) { 1809 if (type & SSL_kPSK) {
1807 /* 1810 pskhintlen = strlen(s->ctx->psk_identity_hint);
1808 * Reserve size for record length and PSK identity hint. 1811 /* reserve size for record length and PSK identity hint*/
1809 */ 1812 n += 2 + pskhintlen;
1810 n += 2 + strlen(s->ctx->psk_identity_hint);
1811 } else 1813 } else
1812#endif /* !OPENSSL_NO_PSK */ 1814#endif /* !OPENSSL_NO_PSK */
1813#ifndef OPENSSL_NO_SRP 1815#ifndef OPENSSL_NO_SRP
@@ -1900,11 +1902,10 @@ ssl3_send_server_key_exchange(SSL *s)
1900#ifndef OPENSSL_NO_PSK 1902#ifndef OPENSSL_NO_PSK
1901 if (type & SSL_kPSK) { 1903 if (type & SSL_kPSK) {
1902 /* copy PSK identity hint */ 1904 /* copy PSK identity hint */
1903 s2n(strlen(s->ctx->psk_identity_hint), p); 1905 s2n(pskhintlen, p);
1904 1906
1905 strncpy((char *)p, s->ctx->psk_identity_hint, 1907 memcpy(p, s->ctx->psk_identity_hint, pskhintlen);
1906 strlen(s->ctx->psk_identity_hint)); 1908 p += pskhintlen;
1907 p += strlen(s->ctx->psk_identity_hint);
1908 } 1909 }
1909#endif 1910#endif
1910 1911