absent identity hint should be NULL
authorDr. Stephen Henson <steve@openssl.org>
Fri, 13 Nov 2015 16:00:29 +0000 (16:00 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 13 Nov 2015 16:00:29 +0000 (16:00 +0000)
Reviewed-by: Matt Caswell <matt@openssl.org>
ssl/statem/statem_clnt.c

index 330cee1..73716b5 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;