int curve_id = 0;
BN_CTX *bn_ctx = NULL;
+#endif
+#ifndef OPENSSL_NO_PSK
+ size_t pskhintlen;
#endif
EVP_PKEY *pkey;
unsigned char *p, *d;
#endif /* !OPENSSL_NO_ECDH */
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
+ pskhintlen = strlen(s->ctx->psk_identity_hint);
/* reserve size for record length and PSK identity hint*/
- n += 2 + strlen(s->ctx->psk_identity_hint);
+ n += 2 + pskhintlen;
} else
#endif /* !OPENSSL_NO_PSK */
{
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
/* copy PSK identity hint */
- s2n(strlen(s->ctx->psk_identity_hint), p);
+ s2n(pskhintlen, p);
- strncpy((char *)p, s->ctx->psk_identity_hint, strlen(s->ctx->psk_identity_hint));
- p += strlen(s->ctx->psk_identity_hint);
+ memcpy(p, s->ctx->psk_identity_hint, pskhintlen);
+ p += pskhintlen;
}
#endif
int curve_id = 0;
BN_CTX *bn_ctx = NULL;
+#endif
+#ifndef OPENSSL_NO_PSK
+ size_t pskhintlen;
#endif
EVP_PKEY *pkey;
const EVP_MD *md = NULL;
#endif /* !OPENSSL_NO_ECDH */
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
- /*
- * Reserve size for record length and PSK identity hint.
- */
- n += 2 + strlen(s->ctx->psk_identity_hint);
+ pskhintlen = strlen(s->ctx->psk_identity_hint);
+ /* reserve size for record length and PSK identity hint*/
+ n += 2 + pskhintlen;
} else
#endif /* !OPENSSL_NO_PSK */
#ifndef OPENSSL_NO_SRP
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
/* copy PSK identity hint */
- s2n(strlen(s->ctx->psk_identity_hint), p);
+ s2n(pskhintlen, p);
- strncpy((char *)p, s->ctx->psk_identity_hint,
- strlen(s->ctx->psk_identity_hint));
- p += strlen(s->ctx->psk_identity_hint);
+ memcpy(p, s->ctx->psk_identity_hint, pskhintlen);
+ p += pskhintlen;
}
#endif
int curve_id = 0;
BN_CTX *bn_ctx = NULL;
+#endif
+#ifndef OPENSSL_NO_PSK
+ size_t pskhintlen;
#endif
EVP_PKEY *pkey;
unsigned char *p, *d;
#endif /* !OPENSSL_NO_ECDH */
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
+ pskhintlen = strlen(s->ctx->psk_identity_hint);
/* reserve size for record length and PSK identity hint*/
- n += 2 + strlen(s->ctx->psk_identity_hint);
+ n += 2 + pskhintlen;
} else
#endif /* !OPENSSL_NO_PSK */
{
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
/* copy PSK identity hint */
- s2n(strlen(s->ctx->psk_identity_hint), p);
+ s2n(pskhintlen, p);
- strncpy((char *)p, s->ctx->psk_identity_hint, strlen(s->ctx->psk_identity_hint));
- p += strlen(s->ctx->psk_identity_hint);
+ memcpy(p, s->ctx->psk_identity_hint, pskhintlen);
+ p += pskhintlen;
}
#endif
int curve_id = 0;
BN_CTX *bn_ctx = NULL;
+#endif
+#ifndef OPENSSL_NO_PSK
+ size_t pskhintlen;
#endif
EVP_PKEY *pkey;
const EVP_MD *md = NULL;
#endif /* !OPENSSL_NO_ECDH */
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
- /*
- * Reserve size for record length and PSK identity hint.
- */
- n += 2 + strlen(s->ctx->psk_identity_hint);
+ pskhintlen = strlen(s->ctx->psk_identity_hint);
+ /* reserve size for record length and PSK identity hint*/
+ n += 2 + pskhintlen;
} else
#endif /* !OPENSSL_NO_PSK */
#ifndef OPENSSL_NO_SRP
#ifndef OPENSSL_NO_PSK
if (type & SSL_kPSK) {
/* copy PSK identity hint */
- s2n(strlen(s->ctx->psk_identity_hint), p);
+ s2n(pskhintlen, p);
- strncpy((char *)p, s->ctx->psk_identity_hint,
- strlen(s->ctx->psk_identity_hint));
- p += strlen(s->ctx->psk_identity_hint);
+ memcpy(p, s->ctx->psk_identity_hint, pskhintlen);
+ p += pskhintlen;
}
#endif