diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-11-11 16:57:52 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-11-11 16:57:52 +0100 |
commit | e6239ef35357824308df079bd6df0dc4b202e898 (patch) | |
tree | 98fc00310f05521efc5108521c7e5c68e96bd988 /rfc2047.c | |
parent | d46f65d38cd819424bfa053f436409b9cd2b51cd (diff) | |
download | mblaze-e6239ef35357824308df079bd6df0dc4b202e898.tar.gz mblaze-e6239ef35357824308df079bd6df0dc4b202e898.tar.xz mblaze-e6239ef35357824308df079bd6df0dc4b202e898.zip |
rfc2047: blaze822_decide_rfc2047: ensure enough space for NUL-termination
Closes #76.
Diffstat (limited to 'rfc2047.c')
-rw-r--r-- | rfc2047.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rfc2047.c b/rfc2047.c index f739269..c152922 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -244,7 +244,7 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc) b = stop + 2; } while (dlen && (s = strstr(b, "=?"))); - while (*b && dlen > 0) { + while (*b && dlen > 1) { *dst++ = *b++; dlen--; } @@ -263,7 +263,7 @@ nocode: iconv_close(ic); free(srcenc); nocodeok: - while (*src && dlen) { + while (*src && dlen > 1) { *dst++ = *src++; dlen--; } |