absent identity hint should be NULL
[openssl.git] / ssl / statem / statem_clnt.c
index 330cee13fc42b537e0c1cc5988455892917f9e0c..73716b5d9b5375afe7c80c1f55092e8be03a9fbb 100644 (file)
@@ -1650,7 +1650,10 @@ MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt)
             goto f_err;
         }
 
-        if (!PACKET_strndup(&psk_identity_hint,
+        if (PACKET_remaining(&psk_identity_hint) == 0) {
+            OPENSSL_free(s->session->psk_identity_hint);
+            s->session->psk_identity_hint = NULL;
+        } else if (!PACKET_strndup(&psk_identity_hint,
                             &s->session->psk_identity_hint)) {
             al = SSL_AD_INTERNAL_ERROR;
             goto f_err;