mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-08 19:02:06 +03:00
pki: Fix random memory corruption
Fixes T78 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -1084,7 +1084,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);
|
||||
@@ -1093,7 +1093,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);
|
||||
|
Reference in New Issue
Block a user