]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
ext: server_name: move name length check prior to IDN convertion
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 26 Mar 2015 10:26:14 +0000 (11:26 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 26 Mar 2015 10:26:14 +0000 (11:26 +0100)
lib/ext/server_name.c

index f661231b9347b1695d0d8673c22ce5d73db5e06e..b0f5b36412a190be186419d965b605e40217eb19 100644 (file)
@@ -385,6 +385,11 @@ gnutls_server_name_set(gnutls_session_t session,
                return GNUTLS_E_INVALID_REQUEST;
        }
 
+       if (name_length == 0) { /* unset extension */
+               _gnutls_ext_unset_session_data(session, GNUTLS_EXTENSION_SERVER_NAME);
+               return 0;
+       }
+
 #ifdef HAVE_LIBIDN
        rc = idna_to_ascii_8z (name, &idn_name, IDNA_ALLOW_UNASSIGNED);
        if (rc != IDNA_SUCCESS) {
@@ -400,11 +405,6 @@ gnutls_server_name_set(gnutls_session_t session,
                goto cleanup;
        }
 
-       if (name_length == 0) { /* unset extension */
-               _gnutls_ext_unset_session_data(session, GNUTLS_EXTENSION_SERVER_NAME);
-               return 0;
-       }
-
        ret =
            _gnutls_ext_get_session_data(session,
                                         GNUTLS_EXTENSION_SERVER_NAME,