Do not treat trailing zeros as part of the crypto text sync
authorVolker Birk <vb@pep.foundation>
Tue, 05 Nov 2019 06:24:35 +0100
branchsync
changeset 4149d17296807b70
parent 4148 2014852faf63
child 4150 5d8e90345bb4
Do not treat trailing zeros as part of the crypto text
src/message_api.c
     1.1 --- a/src/message_api.c	Fri Nov 01 12:15:42 2019 +0100
     1.2 +++ b/src/message_api.c	Tue Nov 05 06:24:35 2019 +0100
     1.3 @@ -2741,13 +2741,18 @@
     1.4                      
     1.5      switch (src->enc_format) {
     1.6          case PEP_enc_PGP_MIME:
     1.7 -            *crypto_text = src->attachments->next->value;
     1.8 -            *text_size = src->attachments->next->size;
     1.9 -            break;
    1.10 -
    1.11 -        case PEP_enc_PGP_MIME_Outlook1:
    1.12 -            *crypto_text = src->attachments->value;
    1.13 -            *text_size = src->attachments->size;
    1.14 +		case PEP_enc_PGP_MIME_Outlook1:
    1.15 +			*crypto_text = src->attachments->next->value;
    1.16 +			if (src->attachments->next->value[src->attachments->next->size - 1]) {
    1.17 +				// if the attachment is not ending with a trailing 0
    1.18 +				// then it is containing the crypto text directly
    1.19 +				*text_size = src->attachments->next->size;
    1.20 +			}
    1.21 +			else {
    1.22 +				// if the attachment is ending with trailing 0
    1.23 +				// then it is containting a string
    1.24 +				*text_size = strlen(src->attachments->next->value);
    1.25 +			}
    1.26              break;
    1.27  
    1.28          case PEP_enc_inline: