Mailing List Archive

Patch to g10/import.c
Hi,

two patches to g10/import.c

* Userid packets with zero flags are rejected, which looks like a bug in
the generating program (why would you include a userid which can be used
for nothing at all??).
* I was trying to repair a PGP 2.3 keyring which had a key without self-
signature, but that caused a segfault (the ->next pointer was NULL).
Changed to log an error message.

Index: base.32/g10/import.c
--- base.32/g10/import.c Thu, 14 Jan 1999 16:31:39 +0100 smurf (gnu_gpg/30_import.c 1.21 644)
+++ noris.1/g10/import.c Fri, 15 Jan 1999 11:09:59 +0100 smurf (gnu_gpg/30_import.c 1.22 644)
@@ -712,13 +712,23 @@
for(node=keyblock->next; node; node = node->next ) {
if( node->pkt->pkttype == PKT_USER_ID ) {
uid_seen = 1;
+ if(!node->flag) {
+ if( opt.verbose ) {
+ log_info_f(fname, _("key %08lX: bad flag on userid '"),
+ (ulong)keyid[1]);
+ print_string( stderr, node->pkt->pkt.user_id->name,
+ node->pkt->pkt.user_id->len, 0 );
+ fputs("', fixed\n",stderr);
+ }
+ node->flag = 1;
+ }
if( (node->flag & 2) || !(node->flag & 1) ) {
if( opt.verbose ) {
log_info_f(fname, _("key %08lX: skipped userid '"),
(ulong)keyid[1]);
print_string( stderr, node->pkt->pkt.user_id->name,
node->pkt->pkt.user_id->len, 0 );
- fputs("'\n", stderr );
+ fprintf(stderr, "', flag %d\n", node->flag);
}
delete_kbnode( node ); /* the user-id */
/* and all following packets up to the next user-id */
@@ -971,13 +981,16 @@
assert(dst->pkt->pkttype == PKT_USER_ID );
assert(src->pkt->pkttype == PKT_USER_ID );
/* at least a self signature comes next to the user-ids */
- assert(src->next->pkt->pkttype != PKT_USER_ID );
- if( dst->next->pkt->pkttype == PKT_USER_ID ) {
+ if( !dst->next || dst->next->pkt->pkttype == PKT_USER_ID ) {
log_error_f(fname, _("key %08lX: our copy has no self-signature\n"),
(ulong)keyid[1]);
return 0;
+ }
+ if( !src->next || src->next->pkt->pkttype == PKT_USER_ID) {
+ log_error_f(fname, _("key %08lX: source key has no self-signature\n"),
+ (ulong)keyid[1]);
+ return 0;
}
-

for(n=src->next; n && n->pkt->pkttype != PKT_USER_ID; n = n->next ) {
if( n->pkt->pkttype != PKT_SIGNATURE )

--
Matthias Urlichs | noris network GmbH | smurf@noris.de | ICQ: 20193661
The quote was selected randomly. Really. | http://www.noris.de/~smurf/
--
I wouldn't take a million dollars for any of my kids, but I wouldn't
pay a dime for another one