diff --git a/g10/export.c b/g10/export.c index a9eba1544..8a4f6f1f3 100644 --- a/g10/export.c +++ b/g10/export.c @@ -985,7 +985,7 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk) unsigned int nbits = valuelen*8; const unsigned char *p = value; - if (nbits >= 8 && !(*p & 0x80)) + if (*p && nbits >= 8 && !(*p & 0x80)) if (--nbits >= 7 && !(*p & 0x40)) if (--nbits >= 6 && !(*p & 0x20)) if (--nbits >= 5 && !(*p & 0x10)) diff --git a/g10/pkglue.c b/g10/pkglue.c index cd6e90838..13f8e2f03 100644 --- a/g10/pkglue.c +++ b/g10/pkglue.c @@ -71,7 +71,7 @@ sexp_extract_param_sos (gcry_sexp_t sexp, const char *param, gcry_mpi_t *r_sos) unsigned int nbits = buflen*8; unsigned char *p = p0; - if (nbits >= 8 && !(*p & 0x80)) + if (*p && nbits >= 8 && !(*p & 0x80)) if (--nbits >= 7 && !(*p & 0x40)) if (--nbits >= 6 && !(*p & 0x20)) if (--nbits >= 5 && !(*p & 0x10))