diff --git a/SOURCES/postfix-3.5.8-whitespace-name-fix.patch b/SOURCES/postfix-3.5.8-whitespace-name-fix.patch
new file mode 100644
index 0000000..c45035e
--- /dev/null
+++ b/SOURCES/postfix-3.5.8-whitespace-name-fix.patch
@@ -0,0 +1,13 @@
+diff --git a/src/cleanup/cleanup_message.c b/src/cleanup/cleanup_message.c
+index 391c711..be5ce42 100644
+--- a/src/cleanup/cleanup_message.c
++++ b/src/cleanup/cleanup_message.c
+@@ -773,6 +773,8 @@ static void cleanup_header_done_callback(void *context)
+ 		    /* Normalize whitespace. */
+ 		    token = tok822_scan_limit(state->fullname, &dummy_token,
+ 					      var_token_limit);
++		    if (!token)
++				token = tok822_alloc(TOK822_QSTRING, state->fullname);
+ 		} else {
+ 		    token = tok822_alloc(TOK822_QSTRING, state->fullname);
+ 		}
diff --git a/SPECS/postfix.spec b/SPECS/postfix.spec
index 5dc9c82..36af153 100644
--- a/SPECS/postfix.spec
+++ b/SPECS/postfix.spec
@@ -49,7 +49,7 @@
 Name: postfix
 Summary: Postfix Mail Transport Agent
 Version: 3.5.8
-Release: 1%{?dist}
+Release: 2%{?dist}
 Epoch: 2
 Group: System Environment/Daemons
 URL: http://www.postfix.org
@@ -97,6 +97,7 @@ Patch9: pflogsumm-1.1.5-datecalc.patch
 Patch10: pflogsumm-1.1.5-ipv6-warnings-fix.patch
 Patch11: postfix-3.4.4-chroot-example-fix.patch
 Patch12: postfix-3.5.8-back-compat-3.3.1.patch
+Patch13: postfix-3.5.8-whitespace-name-fix.patch
 
 # Optional patches - set the appropriate environment variables to include
 #                    them when building the package/spec file
@@ -235,6 +236,8 @@ popd
 # Improve backward compatibility with postfix-3.3.1,
 # for details see rhbz#1688389
 %patch12 -p1 -b .back-compat-3.3.1
+# rhbz#1977732, sent upstream
+%patch13 -p1 -b .whitespace-name-fix
 
 for f in README_FILES/TLS_{LEGACY_,}README TLS_ACKNOWLEDGEMENTS; do
 	iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&
@@ -748,6 +751,10 @@ exit 0
 %endif
 
 %changelog
+* Thu Aug  5 2021 Jaroslav Škarvada <jskarvad@redhat.com> - 2:3.5.8-2
+- Fixed cleanup crash when processing messages with whitespace only fullname
+  Resolves: rhbz#1977732
+
 * Fri Nov 13 2020 Jaroslav Škarvada <jskarvad@redhat.com> - 2:3.5.8-1
 - New version
   Resolves: rhbz#1688389