aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-03-02 21:47:30 +0100
committerLeah Neukirchen <leah@vuxu.org>2019-03-02 21:47:30 +0100
commit023c26f943faac15d49b203080c1d3e19b7db939 (patch)
tree80fbb625298f62bae1eb8322728944bf090c8617
parent081a9404cdedc988b9ad56656da3d1bcbb999521 (diff)
downloadmblaze-023c26f943faac15d49b203080c1d3e19b7db939.tar.gz
rfc2047: blaze822_decode_rfc2047: account for space for trailing nul
-rw-r--r--rfc2047.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/rfc2047.c b/rfc2047.c
index f25762d..b581976 100644
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -130,6 +130,10 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
iconv_t ic = (iconv_t)-1;
char *srcenc = 0;
+ // need space for trailing nul
+ if (dlen-- == 0)
+ return 0;
+
char *startdst = dst;
size_t startdlen = dlen;