ENGINE-27: setting fpr to empty string, not NULL, so set_identity doesn't crash. ENGINE-27
authorKrista Grothoff <krista@pep-project.org>
Mon, 26 Sep 2016 12:40:26 +0200
branchENGINE-27
changeset 119301d0a3e883cc
parent 1192 4fcbac2192c8
child 1194 887976b65446
ENGINE-27: setting fpr to empty string, not NULL, so set_identity doesn't crash.
src/keymanagement.c
     1.1 --- a/src/keymanagement.c	Mon Sep 26 08:18:36 2016 +0200
     1.2 +++ b/src/keymanagement.c	Mon Sep 26 12:40:26 2016 +0200
     1.3 @@ -165,7 +165,6 @@
     1.4              status = blacklist_is_listed(session, identity->fpr, &dont_use_fpr);
     1.5              if (dont_use_fpr) {
     1.6                  free(identity->fpr);
     1.7 -                identity->fpr = NULL;
     1.8              }
     1.9              else {
    1.10                  _did_elect_new_key = 1;
    1.11 @@ -176,7 +175,7 @@
    1.12              assert(identity->fpr);
    1.13              if (identity->fpr == NULL)
    1.14                  return PEP_OUT_OF_MEMORY;
    1.15 -            
    1.16 +                
    1.17          }
    1.18          
    1.19          /* Ok, at this point, we either have a non-blacklisted fpr we can work */
    1.20 @@ -233,6 +232,10 @@
    1.21          }
    1.22      }
    1.23  
    1.24 +    if (identity->fpr == NULL)
    1.25 +        identity->fpr = strdup("");
    1.26 +    
    1.27 +    
    1.28      status = PEP_STATUS_OK;
    1.29  
    1.30      if (identity->comm_type != PEP_ct_unknown && !EMPTYSTR(identity->user_id)) {
    1.31 @@ -275,7 +278,7 @@
    1.32  }
    1.33  
    1.34  PEP_STATUS elect_ownkey(
    1.35 -        PEP_SESSION session, pEp_identity * identity
    1.36 +        PiEP_SESSION session, pEp_identity * identity
    1.37      )
    1.38  {
    1.39      PEP_STATUS status;