]> andersk Git - test.git/commitdiff
sslSNICallback: Properly disallow invalid characters
authorAnders Kaseorg <andersk@mit.edu>
Thu, 12 Jan 2012 00:07:12 +0000 (19:07 -0500)
committerJay Weisskopf <jay@jayschwa.net>
Thu, 2 Feb 2012 02:47:56 +0000 (20:47 -0600)
Completely discard hostnames containing invalid characters, instead of
merely replacing the invalid characters with uninitialized memory.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
libhttp/ssl.c

index 8e3ae02405c550ef234d7f626770a1477648858d..c8de457ddf07b659a1d7a987744ee57f7b82a65f 100755 (executable)
@@ -572,18 +572,14 @@ static int sslSNICallback(SSL *sslHndl, int *al ATTR_UNUSED,
     } else if (ch != '\000' && ch != '.' && ch != '-' &&
                (ch < '0' ||(ch > '9' && ch < 'A') || (ch > 'Z' &&
                 ch < 'a')|| ch > 'z')) {
-      i++;
-      continue;
+      free(serverName);
+      return SSL_TLSEXT_ERR_OK;
     }
     serverName[++i]       = ch;
     if (!ch) {
       break;
     }
   }
-  if (!*serverName) {
-    free(serverName);
-    return SSL_TLSEXT_ERR_OK;
-  }
   SSL_CTX *context        = (SSL_CTX *)getFromTrie(&ssl->sniContexts,
                                                    serverName+1,
                                                    NULL);
This page took 0.049312 seconds and 5 git commands to generate.