about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--rfc2047.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/rfc2047.c b/rfc2047.c
index 47d1e80..3781526 100644
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -163,11 +163,15 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
 
 		int r = iconv(ic, &dec, &declen, &dst, &dlen);
 		if (r < 0) {
-			if (errno == E2BIG)
+			if (errno == E2BIG) {
+				iconv_close(ic);
 				break;
-			perror("iconv");
-			iconv_close(ic);
-			goto nocode;
+			} else if (errno == EILSEQ || errno == EINVAL) {
+				goto nocode;
+			} else {
+				perror("iconv");
+				goto nocode;
+			}
 		}
 
 		iconv_close(ic);