Browse Source

simplified pgp_validate_mem_detached's detached memory assignment. reverted previous change to pgp_validation_t

master
Edouard Tisserant 7 years ago
parent
commit
1e8d2a8003
2 changed files with 8 additions and 7 deletions
  1. +8
    -6
      dist/src/lib/validate.c
  2. +0
    -1
      dist/src/lib/validate.h

+ 8
- 6
dist/src/lib/validate.c View File

@ -515,8 +515,6 @@ validate_data_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
data->detachname);
data->mem = pgp_memory_new();
pgp_mem_readfile(data->mem, data->detachname);
}else if(data->detachmem){
data->mem = data->detachmem;
}
}
if (pgp_get_debug_level(__FILE__)) {
@ -913,6 +911,7 @@ pgp_validate_file(pgp_io_t *io,
\param mem Memory to be validated
\param user_says_armoured Treat data as armoured, if set
\param keyring Keyring to use
\param detachmem detached memory (free done in this call if provided)
\return 1 if signature validates successfully; 0 if not
\note After verification, result holds the details of all keys which
have passed, failed and not been recognised.
@ -937,11 +936,14 @@ _pgp_validate_mem(pgp_io_t *io,
/* Set verification reader and handling options */
(void) memset(&validation, 0x0, sizeof(validation));
if (detachmem) validation.detachmem = detachmem;
validation.result = result;
validation.keyring = keyring;
validation.mem = pgp_memory_new();
pgp_memory_init(validation.mem, 128);
if (detachmem) {
validation.mem = detachmem;
}else{
validation.mem = pgp_memory_new();
pgp_memory_init(validation.mem, 128);
}
/* Note: Coverity incorrectly reports an error that validation.reader */
/* is never used. */
validation.reader = stream->readinfo.arg;
@ -969,7 +971,7 @@ _pgp_validate_mem(pgp_io_t *io,
/* need to send validated output somewhere */
*cat = validation.mem;
} else {
pgp_memory_free(validation.mem);
pgp_memory_free(validation.mem);
}
return validate_result_status(io->errs, NULL, result);


+ 0
- 1
dist/src/lib/validate.h View File

@ -90,7 +90,6 @@ typedef struct {
validate_reader_t *reader;/* reader-specific arg */
pgp_validation_t *result;
char *detachname;
pgp_memory_t *detachmem;
} validate_data_cb_t;
void pgp_keydata_reader_set(pgp_stream_t *, const pgp_key_t *);


Loading…
Cancel
Save