From 7a82ae32695adc63d33597cf49e950a4195b8fd6 Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Wed, 8 Feb 2017 21:41:51 +0100 Subject: [PATCH] b64_decode_part(): fix possible assertion (size must be GT len!) --- mime_enc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mime_enc.c b/mime_enc.c index b4cb10af..0c4a3809 100644 --- a/mime_enc.c +++ b/mime_enc.c @@ -978,7 +978,14 @@ b64_decode_part(struct str *out, struct str const *in, struct str *outrest, NYD_ENTER; n_string_creat(&s); - n_string_take_ownership(&s, out->s, out->l, out->l); + if((len = out->l) > 0 && out->s[len] == '\0') + n_string_take_ownership(&s, out->s, len +1, len); + else{ + if(len > 0) + n_string_push_buf(&s, out->s, len); + if(out->s != NULL) + free(out->s); + } out->s = NULL, out->l = 0; n_string_creat(&workbuf); -- 2.11.4.GIT