ENGINE-588: same adjustment to the import function sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Fri, 05 Jul 2019 10:34:52 +0200
branchsync
changeset 3900c8d13d59a185
parent 3899 f37db118e0b0
child 3901 cdfe2dddb5da
ENGINE-588: same adjustment to the import function
src/pgp_sequoia.c
     1.1 --- a/src/pgp_sequoia.c	Thu Jul 04 21:34:44 2019 +0200
     1.2 +++ b/src/pgp_sequoia.c	Fri Jul 05 10:34:52 2019 +0200
     1.3 @@ -2022,7 +2022,13 @@
     1.4      PEP_STATUS retval = PEP_KEY_IMPORTED;
     1.5      
     1.6      for (i = 0, curr_begin = key_data; i < keycount; i++) {
     1.7 -        const char* next_begin = strstr(curr_begin + prefix_len, pgp_begin);
     1.8 +        const char* next_begin = NULL;
     1.9 +
    1.10 +        // This is assured to be OK because the count function above 
    1.11 +        // made sure that THIS round contains at least prefix_len chars
    1.12 +        if (strlen(curr_begin + prefix_len) > prefix_len)
    1.13 +            next_begin = strstr(curr_begin + prefix_len, pgp_begin);
    1.14 +
    1.15          if (next_begin)
    1.16              curr_size = next_begin - curr_begin;
    1.17          else