ref: b467af556389db6dbe4775d131f0f56aadb9fbfe
parent: 3654e2a6c2ce647628929b994e68185a56f7d7df
author: igor <igor@mux>
date: Thu Oct 6 19:46:04 EDT 2022
tlshand: improve parsing of SNI extension.
--- a/tlshand.c
+++ b/tlshand.c
@@ -664,10 +664,9 @@
case Extsni:
if(n < 4 || get16(p) != (n -= 2))
goto Short;
- p += 2;
- if(*p++ != 0) /* Server Name Type: host_name */
+ if(*(p+2) != 0) /* Server Name Type: host_name */
break;
- p += 2;
+ p += 2+1+2;
if(e-p < (n = get16(p-2)))
goto Short;
if(n > 255) /* DNS name can not exceed 255 bytes RFC1035 */