[gnutls-dev] [algernon at sirc.hu: Bug#188838: libgnutls5: Server name indication does not appear to work]

Nikos Mavroyanopoulos nmav at gnutls.org
Mon Apr 14 09:45:02 CEST 2003


On Sun, Apr 13, 2003 at 04:16:16PM +0200, Ivo Timmermans wrote:

> FYI, what do you think of the attached patch?
A patch the corrects the problem is attached. It seems that
the problem was indeed in the send part :)


> 	Ivo

-- 
Nikos Mavroyanopoulos
-------------- next part --------------
Index: ext_server_name.c
===================================================================
RCS file: /cvs/gnutls/gnutls/lib/ext_server_name.c,v
retrieving revision 2.11
diff -u -u -r2.11 ext_server_name.c
--- ext_server_name.c	25 Mar 2003 18:01:47 -0000	2.11
+++ ext_server_name.c	14 Apr 2003 07:38:42 -0000
@@ -46,7 +46,7 @@
    if (session->security_parameters.entity == GNUTLS_SERVER) {
       DECR_LENGTH_RET(data_size, 2, 0);
       len = _gnutls_read_uint16(data);
-      
+
       if ( len != data_size) {
          /* This is unexpected packet length, but
           * just ignore it, for now.
@@ -121,7 +121,8 @@
    ssize_t data_size = _data_size;
    int total_size = 0;
 
-   /* this function sends the client extension data (dnsname) */
+   /* this function sends the client extension data (dnsname) 
+    */
    if (session->security_parameters.entity == GNUTLS_CLIENT) {
 
       /* uint16 */
@@ -130,9 +131,12 @@
 	   i < session->security_parameters.extensions.server_names_size;
 	   i++) 
       {
-	   /* count the total size */
+	   /* count the total size 
+	    */
 	   len = session->security_parameters.extensions.server_names[i].name_length;
-	   /* uint8 + uint16 + size */
+
+	   /* uint8 + uint16 + size 
+	    */
 	   total_size += 1 + 2 + len;
       }
 
@@ -141,7 +145,7 @@
       /* UINT16: write total size of all names 
        */
       DECR_LENGTH_RET( data_size, 2, GNUTLS_E_SHORT_MEMORY_BUFFER);
-      _gnutls_write_uint16(total_size, p);
+      _gnutls_write_uint16(total_size-2, p);
       p += 2;
 
       for (i = 0;
@@ -179,8 +183,7 @@
 	 }
       }
    }
-   if (total_size == 0)
-      return 0;
+
    return total_size;
 }
 


More information about the Gnutls-devel mailing list