From e237a835f2bb9967ed92fbc785a9957b14c74450 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Mon, 26 Mar 2012 23:23:34 +1100 Subject: [PATCH] gracefully skip unrecognised key types --- ssh/authfd.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ssh/authfd.c b/ssh/authfd.c index 350f2b5..7a3d262 100644 --- a/ssh/authfd.c +++ b/ssh/authfd.c @@ -332,7 +332,7 @@ ssh_fetch_identitylist(int sock, int version, struct ssh_identitylist **idlp) r = SSH_ERR_ALLOC_FAIL; goto out; } - for (i = 0; i < num; i++) { + for (i = 0; i < num;) { switch (version) { case 1: if ((r = deserialise_identity1(msg, @@ -341,10 +341,17 @@ ssh_fetch_identitylist(int sock, int version, struct ssh_identitylist **idlp) break; case 2: if ((r = deserialise_identity2(msg, - &(idl->keys[i]), &(idl->comments[i]))) != 0) - goto out; + &(idl->keys[i]), &(idl->comments[i]))) != 0) { + if (r == SSH_ERR_KEY_TYPE_UNKNOWN) { + /* Gracefully skip unknown key types */ + num--; + continue; + } else + goto out; + } break; } + i++; } idl->nkeys = num; *idlp = idl;