* Make a note of any other host key formats that are available.
*/
{
- int i, j = 0;
+ int i, j;
char *list = NULL;
for (i = 0; i < lenof(hostkey_algs); i++) {
if (hostkey_algs[i].alg == ssh->hostkey)
continue;
- else if (ssh->uncert_hostkeys[j] == i) {
+
+ for (j = 0; j < ssh->n_uncert_hostkeys; j++)
+ if (ssh->uncert_hostkeys[j] == i)
+ break;
+
+ if (j < ssh->n_uncert_hostkeys) {
char *newlist;
if (list)
newlist = dupprintf("%s/%s", list,
newlist = dupprintf("%s", hostkey_algs[i].alg->name);
sfree(list);
list = newlist;
- j++;
- /* Assumes that hostkey_algs and uncert_hostkeys are
- * sorted in the same order */
- if (j == ssh->n_uncert_hostkeys)
- break;
- else
- assert(ssh->uncert_hostkeys[j] >
- ssh->uncert_hostkeys[j-1]);
}
}
if (list) {