summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--rfc2047.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rfc2047.c b/rfc2047.c
index c152922..ab65772 100644
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -132,7 +132,7 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
 
 	char *b = src;
 
-	// use memmem
+	// XXX use memmem
 	char *s = strstr(src, "=?");
 	if (!s)
 		goto nocodeok;
@@ -233,6 +233,9 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
 			}
 		}
 
+		if (memchr(dst, 0, dlen))
+			goto nocode;
+
 		while (!partial && declen && dlen) {
 			*dst++ = *dec++;
 			declen--;