pki: Fix random memory corruption

Fixes T78

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 1444ae5add)
This commit is contained in:
Andreas Schneider
2018-06-29 09:22:26 +02:00
parent e2b48dc662
commit a1847660a3

View File

@@ -999,7 +999,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
key_buf[size] = '\0';
q = p = key_buf;
while (!isspace((int)*p)) p++;
while (*p != '\0' && !isspace((int)*p)) p++;
*p = '\0';
type = ssh_key_type_from_name(q);
@@ -1008,7 +1008,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
return SSH_ERROR;
}
q = ++p;
while (!isspace((int)*p)) p++;
while (*p != '\0' && !isspace((int)*p)) p++;
*p = '\0';
rc = ssh_pki_import_pubkey_base64(q, type, pkey);