~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix a mishandling of error returns from makekey() in the SSH-1 private
[sgt/putty]
/
cmdgen.c
diff --git
a/cmdgen.c
b/cmdgen.c
index
50f99f7
..
33662c3
100644
(file)
--- a/
cmdgen.c
+++ b/
cmdgen.c
@@
-118,10
+118,7
@@
void sk_cleanup(void)
void showversion(void)
{
void showversion(void)
{
- char *verstr = dupstr(ver);
- verstr[0] = tolower((unsigned char)verstr[0]);
- printf("PuTTYgen %s\n", verstr);
- sfree(verstr);
+ printf("puttygen: %s\n", ver);
}
void usage(int standalone)
}
void usage(int standalone)
@@
-667,7
+664,7
@@
int main(int argc, char **argv)
return 1;
}
random_add_heavynoise(entropy, bits / 8);
return 1;
}
random_add_heavynoise(entropy, bits / 8);
-
memset(entropy, 0
, bits/8);
+
smemclr(entropy
, bits/8);
sfree(entropy);
if (keytype == DSA) {
sfree(entropy);
if (keytype == DSA) {
@@
-766,6
+763,9
@@
int main(int argc, char **argv)
}
ssh1key->comment = dupstr(origcomment);
ssh1key->private_exponent = NULL;
}
ssh1key->comment = dupstr(origcomment);
ssh1key->private_exponent = NULL;
+ ssh1key->p = NULL;
+ ssh1key->q = NULL;
+ ssh1key->iqmp = NULL;
} else {
ret = loadrsakey(infilename, ssh1key, passphrase, &error);
}
} else {
ret = loadrsakey(infilename, ssh1key, passphrase, &error);
}
@@
-779,11
+779,13
@@
int main(int argc, char **argv)
if (!load_encrypted) {
ssh2blob = ssh2_userkey_loadpub(infilename, &ssh2alg,
&ssh2bloblen, NULL, &error);
if (!load_encrypted) {
ssh2blob = ssh2_userkey_loadpub(infilename, &ssh2alg,
&ssh2bloblen, NULL, &error);
- ssh2algf = find_pubkey_alg(ssh2alg);
- if (ssh2algf)
- bits = ssh2algf->pubkey_bits(ssh2blob, ssh2bloblen);
- else
- bits = -1;
+ if (ssh2blob) {
+ ssh2algf = find_pubkey_alg(ssh2alg);
+ if (ssh2algf)
+ bits = ssh2algf->pubkey_bits(ssh2blob, ssh2bloblen);
+ else
+ bits = -1;
+ }
} else {
ssh2key = ssh2_load_userkey(infilename, passphrase, &error);
}
} else {
ssh2key = ssh2_load_userkey(infilename, passphrase, &error);
}
@@
-860,7
+862,7
@@
int main(int argc, char **argv)
return 1;
}
if (passphrase) {
return 1;
}
if (passphrase) {
-
memset(passphrase, 0
, strlen(passphrase));
+
smemclr(passphrase
, strlen(passphrase));
sfree(passphrase);
}
passphrase = dupstr(p->prompts[0]->result);
sfree(passphrase);
}
passphrase = dupstr(p->prompts[0]->result);
@@
-1035,7
+1037,7
@@
int main(int argc, char **argv)
}
if (passphrase) {
}
if (passphrase) {
-
memset(passphrase, 0
, strlen(passphrase));
+
smemclr(passphrase
, strlen(passphrase));
sfree(passphrase);
}
sfree(passphrase);
}