From: simon Date: Tue, 28 Aug 2001 08:36:27 +0000 (+0000) Subject: Fix externally added SSH1 keys in Pageant. I have no idea how this X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/commitdiff_plain/080954b86f2b5d52a6ab8401faeb9ac4dd9c7e08 Fix externally added SSH1 keys in Pageant. I have no idea how this code _ever_ worked before! But it's been like this for four months and nobody has noticed, including me. That's quite spooky. git-svn-id: svn://svn.tartarus.org/sgt/putty@1219 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/pageant.c b/pageant.c index 503cb857..e0018639 100644 --- a/pageant.c +++ b/pageant.c @@ -650,16 +650,19 @@ static void answer_msg(void *msg) { struct RSAKey *key; char *comment; + int commentlen; key = smalloc(sizeof(struct RSAKey)); memset(key, 0, sizeof(key)); p += makekey(p, key, NULL, 1); p += makeprivate(p, key); - p += ssh1_read_bignum(p, key->iqmp); /* p^-1 mod q */ - p += ssh1_read_bignum(p, key->p); /* p */ - p += ssh1_read_bignum(p, key->q); /* q */ - comment = smalloc(GET_32BIT(p)); + p += ssh1_read_bignum(p, &key->iqmp); /* p^-1 mod q */ + p += ssh1_read_bignum(p, &key->p); /* p */ + p += ssh1_read_bignum(p, &key->q); /* q */ + commentlen = GET_32BIT(p); + comment = smalloc(commentlen+1); if (comment) { - memcpy(comment, p + 4, GET_32BIT(p)); + memcpy(comment, p + 4, commentlen); + comment[commentlen] = '\0'; key->comment = comment; } PUT_32BIT(ret, 1);