From 385e5106c2c64c1b8f786dbaf875fb2fb1062016 Mon Sep 17 00:00:00 2001 From: "Dolf Schimmel (Freeaqingme)" Date: Tue, 1 Sep 2015 21:15:14 +0200 Subject: [PATCH] Max IPv6 address length is 45 characters, not 16 The idea was to reserve 16 bytes for an IPv6 address. But given that a human representation is used rather than a 128 bit integer, we need 45 characters at most. --- gomilter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gomilter.go b/gomilter.go index 661b0a4..edbdb26 100644 --- a/gomilter.go +++ b/gomilter.go @@ -212,12 +212,12 @@ func Go_xxfi_connect(ctx *C.SMFICTX, hostname *C.char, hostaddr *C._SOCK_ADDR) C } else if hostaddr.sa_family == C.AF_INET6 { sa_in := (*C.struct_sockaddr_in6)(unsafe.Pointer(hostaddr)) - var dst = make([]byte, 16) + var dst = make([]byte, 45) C.inet_ntop( C.int(hostaddr.sa_family), unsafe.Pointer(&sa_in.sin6_addr), (*C.char)(unsafe.Pointer(&dst)), - 16) + 45) ip = net.ParseIP(C.GoString((*C.char)(unsafe.Pointer(&dst)))) } else {