I was testing out gmid by connecting with openssl s_client, and noticed that if SNI is missing, it crashes when trying to log the request because c->iri has not been populated yet:
==837== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==837== Access not within mapped region at address 0x0
==837== at 0x4A75870: strlcpy (in /usr/lib/libbsd.so.0.10.0)
==837== by 0x10AC16: log_request (gmid.c:123)
==837== by 0x10DDBD: start_reply (server.c:274)
==837== by 0x10D958: handle_handshake (server.c:200)
==837== by 0x10EBB9: handle (server.c:577)
==837== by 0x10EF7B: loop (server.c:665)
==837== by 0x10B574: listener_main (gmid.c:332)
==837== by 0x10B975: main (gmid.c:459)
Good catch! I wrote that code just yesterday and it wasn't really tested yet. It would crash also when an unknown vhost was requested (if running with a config).
I was testing out gmid by connecting with
openssl s_client
, and noticed that if SNI is missing, it crashes when trying to log the request becausec->iri
has not been populated yet: