mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Merge branch 'pre-0.64'
This commit is contained in:
20
sshpubk.c
20
sshpubk.c
@ -67,7 +67,7 @@ static int loadrsakey_main(FILE * fp, struct RSAKey *key, int pub_only,
|
||||
i += 4;
|
||||
|
||||
/* Now the serious stuff. An ordinary SSH-1 public key. */
|
||||
j = makekey(buf + i, len, key, NULL, 1);
|
||||
j = makekey(buf + i, len - i, key, NULL, 1);
|
||||
if (j < 0)
|
||||
goto end; /* overran */
|
||||
i += j;
|
||||
@ -802,6 +802,7 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
|
||||
goto error;
|
||||
}
|
||||
sfree(public_blob);
|
||||
smemclr(private_blob, private_blob_len);
|
||||
sfree(private_blob);
|
||||
sfree(encryption);
|
||||
if (errorstr)
|
||||
@ -822,8 +823,10 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
|
||||
sfree(mac);
|
||||
if (public_blob)
|
||||
sfree(public_blob);
|
||||
if (private_blob)
|
||||
sfree(private_blob);
|
||||
if (private_blob) {
|
||||
smemclr(private_blob, private_blob_len);
|
||||
sfree(private_blob);
|
||||
}
|
||||
if (errorstr)
|
||||
*errorstr = error;
|
||||
return ret;
|
||||
@ -1112,8 +1115,14 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
|
||||
}
|
||||
|
||||
fp = f_open(filename, "w", TRUE);
|
||||
if (!fp)
|
||||
return 0;
|
||||
if (!fp) {
|
||||
sfree(pub_blob);
|
||||
smemclr(priv_blob, priv_blob_len);
|
||||
sfree(priv_blob);
|
||||
smemclr(priv_blob_encrypted, priv_blob_len);
|
||||
sfree(priv_blob_encrypted);
|
||||
return 0;
|
||||
}
|
||||
fprintf(fp, "PuTTY-User-Key-File-2: %s\n", key->alg->name);
|
||||
fprintf(fp, "Encryption: %s\n", cipherstr);
|
||||
fprintf(fp, "Comment: %s\n", key->comment);
|
||||
@ -1130,6 +1139,7 @@ int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
|
||||
sfree(pub_blob);
|
||||
smemclr(priv_blob, priv_blob_len);
|
||||
sfree(priv_blob);
|
||||
smemclr(priv_blob_encrypted, priv_blob_len);
|
||||
sfree(priv_blob_encrypted);
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user