ENGINE-857: revert and NUL char fix. Release_2.1 Release_2.1.9
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Tue, 24 Nov 2020 07:07:18 +0100
branchRelease_2.1
changeset 5206afde4de54783
parent 5205 a0c3c7e9fe68
child 5207 037093a53efd
child 5215 df2ddd9c359c
ENGINE-857: revert and NUL char fix.
src/etpan_mime.c
     1.1 --- a/src/etpan_mime.c	Mon Nov 23 18:34:02 2020 +0100
     1.2 +++ b/src/etpan_mime.c	Tue Nov 24 07:07:18 2020 +0100
     1.3 @@ -2494,10 +2494,9 @@
     1.4  
     1.5      if (part->mm_content_type) {
     1.6          if (_get_content_type(part->mm_content_type, &type, &charset) == 0) {
     1.7 -            if (charset && (strlen(charset) < 5 || strncasecmp(charset, "utf-8", 5) != 0)) {
     1.8 +            if (charset && strncasecmp(charset, "utf-8", 5) != 0) {
     1.9                  char * _text;
    1.10 -                size_t new_size;
    1.11 -                int r = charconv_buffer("utf-8", charset, _longmsg, _size, &_text, &new_size);
    1.12 +                int r = charconv("utf-8", charset, _longmsg, _size, &_text);
    1.13                  switch (r) {
    1.14                      case MAILIMF_NO_ERROR:
    1.15                          break;
    1.16 @@ -2507,16 +2506,14 @@
    1.17                          return PEP_ILLEGAL_VALUE;
    1.18                  }
    1.19                  free(_longmsg);
    1.20 -                _longmsg = (char*)(malloc(new_size));
    1.21 -                if (!_longmsg || !memcpy(_longmsg, _text, new_size))
    1.22 -                    return PEP_OUT_OF_MEMORY;
    1.23 -                charconv_buffer_free(_text);
    1.24 -                _size = new_size;
    1.25 +                _longmsg = _text;
    1.26 +                _size = strlen(_longmsg);
    1.27              }
    1.28          }
    1.29      }
    1.30      // FIXME: KG - we now have the text we want.
    1.31      // Now we need to strip sigs and process them if they are there..
    1.32 +    
    1.33  
    1.34      *longmsg = _longmsg;
    1.35      if (size)