rfc2047: blaze822_decode_b64: ensure nul-termination of result

Fixes #70.
pull/71/head
Leah Neukirchen 7 years ago
parent 7fd982d172
commit 3b51c5938a

@ -75,7 +75,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
};
char *buf = malloc((e - s) / 4 * 3);
char *buf = malloc((e - s) / 4 * 3 + 1);
if (!buf)
return 0;
@ -118,6 +118,8 @@ error:
if (c3 != '=') *buf++ = d2;
}
*buf = 0;
*decleno = buf - *deco;
return 1;
}

Loading…
Cancel
Save