Possibly related to P4A-589 - separate_short_and_long should not be called when msg->longmsg is NULL (e.g. HTML-only mails)
authorKrista Bennett <krista@pep-project.org>
Wed, 04 Oct 2017 12:16:54 +0200
changeset 21338a0f69a8d5f0
parent 2132 70105db2d539
child 2134 18296e7dc860
Possibly related to P4A-589 - separate_short_and_long should not be called when msg->longmsg is NULL (e.g. HTML-only mails)
src/message_api.c
     1.1 --- a/src/message_api.c	Tue Oct 03 18:03:26 2017 +0200
     1.2 +++ b/src/message_api.c	Wed Oct 04 12:16:54 2017 +0200
     1.3 @@ -1983,14 +1983,16 @@
     1.4                  if (src->shortmsg == NULL || strcmp(src->shortmsg, "pEp") == 0 ||
     1.5                      _unsigned_signed_strcmp(pepstr, src->shortmsg, PEP_SUBJ_BYTELEN) == 0)
     1.6                  {
     1.7 -                    char * shortmsg;
     1.8 -                    char * longmsg;
     1.9 -
    1.10 -                    int r = separate_short_and_long(msg->longmsg, &shortmsg,
    1.11 -                            &longmsg);
    1.12 +                    char * shortmsg = NULL;
    1.13 +                    char * longmsg = NULL;
    1.14 +
    1.15 +                    if (msg->longmsg) {
    1.16 +                        int r = separate_short_and_long(msg->longmsg, &shortmsg,
    1.17 +                                &longmsg);
    1.18                      
    1.19 -                    if (r == -1)
    1.20 -                        goto enomem;
    1.21 +                        if (r == -1)
    1.22 +                            goto enomem;
    1.23 +                    }
    1.24  
    1.25                      if (shortmsg == NULL) {
    1.26                          if (src->shortmsg == NULL)