From cee577790b4c6c9533c46492282d520eef420f7e Mon Sep 17 00:00:00 2001 From: "fox.cpp" Date: Thu, 8 Feb 2024 12:31:20 +0300 Subject: [PATCH] address: Special-case null return-path in normalization functions See #629. --- framework/address/norm.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/address/norm.go b/framework/address/norm.go index 510fb63b..6998e662 100644 --- a/framework/address/norm.go +++ b/framework/address/norm.go @@ -36,6 +36,10 @@ import ( // // On error, case-folded addr is also returned. func ForLookup(addr string) (string, error) { + if addr == "" { // Null return-path case. + return "", nil + } + mbox, domain, err := Split(addr) if err != nil { return strings.ToLower(addr), err @@ -64,6 +68,10 @@ func ForLookup(addr string) (string, error) { // // Original value is also returned on the error. func CleanDomain(addr string) (string, error) { + if addr == "" { // Null return-path + return "", nil + } + mbox, domain, err := Split(addr) if err != nil { return addr, err