--- socat-orig/socat-1.7.4.1/xio-openssl.c 2021-01-10 04:57:35.000000000 -0800
+++ socat-1.7.4.1/xio-openssl.c 2021-07-12 03:17:23.772269622 -0700
@@ -1777,15 +1777,17 @@
#if WITH_IP6
case 16: /* IPv6 */
inet_ntop(AF_INET6, data, aBuffer, sizeof(aBuffer));
- xioip6_pton(peername, &ip6bin);
- if (memcmp(data, &ip6bin, sizeof(ip6bin)) == 0) {
- Debug2("subjectAltName \"%s\" matches peername \"%s\"",
- aBuffer, peername);
- ok = 1;
- } else {
- Info2("subjectAltName \"%s\" does not match peername \"%s\"",
- aBuffer, peername);
- }
+ if (peername != NULL) {
+ xioip6_pton(peername, &ip6bin);
+ if (memcmp(data, &ip6bin, sizeof(ip6bin)) == 0) {
+ Debug2("subjectAltName \"%s\" matches peername \"%s\"",
+ aBuffer, peername);
+ ok = 1;
+ } else {
+ Info2("subjectAltName \"%s\" does not match peername \"%s\"",
+ aBuffer, peername);
+ }
+ }
break;
#endif
}