mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
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:
@@ -999,7 +999,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
|
|||||||
key_buf[size] = '\0';
|
key_buf[size] = '\0';
|
||||||
|
|
||||||
q = p = key_buf;
|
q = p = key_buf;
|
||||||
while (!isspace((int)*p)) p++;
|
while (*p != '\0' && !isspace((int)*p)) p++;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
type = ssh_key_type_from_name(q);
|
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;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
q = ++p;
|
q = ++p;
|
||||||
while (!isspace((int)*p)) p++;
|
while (*p != '\0' && !isspace((int)*p)) p++;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
rc = ssh_pki_import_pubkey_base64(q, type, pkey);
|
rc = ssh_pki_import_pubkey_base64(q, type, pkey);
|
||||||
|
|||||||
Reference in New Issue
Block a user