check for unencrypted before attempting to use dst->_sender_fpr ENGINE-647
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 25 Sep 2019 11:39:09 +0200
branchENGINE-647
changeset 40869e0c5c49a4c7
parent 4081 97df66f82ae0
child 4087 3336ad3b4e61
check for unencrypted before attempting to use dst->_sender_fpr
src/message_api.c
     1.1 --- a/src/message_api.c	Mon Sep 23 09:52:19 2019 +0200
     1.2 +++ b/src/message_api.c	Wed Sep 25 11:39:09 2019 +0200
     1.3 @@ -4063,7 +4063,10 @@
     1.4              
     1.5              PEP_STATUS tmpstatus = base_extract_message(session, msg, &size, &data, &sender_fpr);
     1.6              if (!tmpstatus && size && data) {
     1.7 -                const char* event_sender_fpr = ((*dst)->_sender_fpr ? (*dst)->_sender_fpr : sender_fpr);
     1.8 +                bool use_extracted_fpr = (status != PEP_DECRYPTED_AND_VERIFIED) ||
     1.9 +                                          !dst || !(*dst) || !((*dst)->_sender_fpr);
    1.10 +                
    1.11 +                const char* event_sender_fpr = (use_extracted_fpr ? sender_fpr : (*dst)->_sender_fpr);
    1.12                  // FIXME - I don't think this is OK anymore. We either have a signed beacon or a properly encrypted/signed 2.1 message
    1.13                  // if ((!event_sender_fpr) && *keylist)
    1.14                  //     event_sender_fpr = (*keylist)->value;