mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
fixed m_alloc(0) bug and added checks to revkey and numrevkeys
This commit is contained in:
parent
4991e018bf
commit
158091ef9f
@ -1,3 +1,13 @@
|
||||
2002-05-04 Stefan Bellon <sbellon@sbellon.de>
|
||||
|
||||
* free-packet.c (copy_public_key): Don't call m_alloc(0), therefore
|
||||
added consistency check for revkey and numrefkeys.
|
||||
|
||||
* getkey.c (check_revocation_keys): Added consistency check for
|
||||
revkey and numrefkeys.
|
||||
|
||||
* keyedit.c (show_key_with_all_names): Likewise.
|
||||
|
||||
2002-05-03 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* photoid.c: Provide default image viewer for Win32.
|
||||
|
@ -164,8 +164,14 @@ copy_public_key ( PKT_public_key *d, PKT_public_key *s)
|
||||
for(i=0; i < n; i++ )
|
||||
d->pkey[i] = mpi_copy( s->pkey[i] );
|
||||
}
|
||||
if( !s->revkey && s->numrevkeys )
|
||||
BUG();
|
||||
if( s->numrevkeys ) {
|
||||
d->revkey = m_alloc(sizeof(struct revocation_key)*s->numrevkeys);
|
||||
memcpy(d->revkey,s->revkey,sizeof(struct revocation_key)*s->numrevkeys);
|
||||
}
|
||||
else
|
||||
d->revkey = NULL;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
12
g10/getkey.c
12
g10/getkey.c
@ -2314,20 +2314,20 @@ check_revocation_keys(PKT_public_key *pk,PKT_signature *sig)
|
||||
(ulong)sig->keyid[1]); */
|
||||
|
||||
/* is the issuer of the sig one of our revokers? */
|
||||
for(i=0;i<pk->numrevkeys;i++)
|
||||
{
|
||||
if( !pk->revkey && pk->numrevkeys )
|
||||
BUG();
|
||||
else
|
||||
for(i=0;i<pk->numrevkeys;i++) {
|
||||
u32 keyid[2];
|
||||
|
||||
keyid_from_fingerprint(pk->revkey[i].fpr,MAX_FINGERPRINT_LEN,keyid);
|
||||
|
||||
if(keyid[0]==sig->keyid[0] && keyid[1]==sig->keyid[1])
|
||||
{
|
||||
if(keyid[0]==sig->keyid[0] && keyid[1]==sig->keyid[1]) {
|
||||
MD_HANDLE md;
|
||||
|
||||
md=md_open(sig->digest_algo,0);
|
||||
hash_public_key(md,pk);
|
||||
if(signature_check(sig,md)==0)
|
||||
{
|
||||
if(signature_check(sig,md)==0) {
|
||||
rc=0;
|
||||
break;
|
||||
}
|
||||
|
@ -1478,9 +1478,11 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
}
|
||||
}
|
||||
|
||||
if(with_revoker)
|
||||
for(i=0;i<pk->numrevkeys;i++)
|
||||
{
|
||||
if(with_revoker) {
|
||||
if( !pk->revkey && pk->numrevkeys )
|
||||
BUG();
|
||||
else
|
||||
for(i=0;i<pk->numrevkeys;i++) {
|
||||
u32 r_keyid[2];
|
||||
char *user;
|
||||
|
||||
@ -1496,6 +1498,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
|
||||
m_free(user);
|
||||
}
|
||||
}
|
||||
|
||||
tty_printf(_("%s%c %4u%c/%08lX created: %s expires: %s"),
|
||||
node->pkt->pkttype == PKT_PUBLIC_KEY? "pub":"sub",
|
||||
|
Loading…
x
Reference in New Issue
Block a user