summaryrefslogtreecommitdiff
path: root/lib/mime.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2017-10-19 18:33:27 +0100
committerPatrick Monnerat <patrick@monnerat.net>2017-10-19 18:33:27 +0100
commita8742efe42d72e25a8c5041db35115dbf4fa6c45 (patch)
treecc761732e9b15f3b00e886bcf4ca68b37f0b3027 /lib/mime.c
parent2509395ecf57765542b7137d84d16eedc0abb835 (diff)
downloadcurl-a8742efe42d72e25a8c5041db35115dbf4fa6c45.tar.gz
mime: limit bas64-encoded lines length to 76 characters
Diffstat (limited to 'lib/mime.c')
-rw-r--r--lib/mime.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mime.c b/lib/mime.c
index c3c370891..d9b7f524e 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -406,7 +406,7 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
while(st->bufbeg < st->bufend) {
/* Line full ? */
- if(st->pos >= MAX_ENCODED_LINE_LENGTH - 4) {
+ if(st->pos > MAX_ENCODED_LINE_LENGTH - 4) {
/* Yes, we need 2 characters for CRLF. */
if(size < 2)
break;
@@ -421,7 +421,7 @@ static size_t encoder_base64_read(char *buffer, size_t size, bool ateof,
if(size < 4 || st->bufend - st->bufbeg < 3)
break;
- /* Encode three bytes a four characters. */
+ /* Encode three bytes as four characters. */
i = st->buf[st->bufbeg++] & 0xFF;
i = (i << 8) | (st->buf[st->bufbeg++] & 0xFF);
i = (i << 8) | (st->buf[st->bufbeg++] & 0xFF);