1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-18 19:41:01 -05:00

Remove a load of obsolete printf string limits.

In the previous commit I happened to notice a %.150s in a ppl_logevent
call, which was probably an important safety precaution a couple of
decades ago when that format string was being used for an sprintf into
a fixed-size buffer, but now it's just pointless cruft.

This commit removes all printf string formatting directives with a
compile-time fixed size, with the one exception of a %.3s used to cut
out a 3-letter month name in scpserver.c. In cases where the format
string in question was already going to an arbitrary-length function
like dupprintf or ppl_logevent, that's all I've done; in cases where
there was still a fixed-size buffer, I've replaced it with a dynamic
buffer and dupprintf.
This commit is contained in:
Simon Tatham
2018-12-08 21:03:51 +00:00
parent e08641c912
commit 3322d4c082
6 changed files with 70 additions and 56 deletions

View File

@ -225,7 +225,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
*/
if (!filename_is_null(s->keyfile)) {
int keytype;
ppl_logevent("Reading key file \"%.150s\"",
ppl_logevent("Reading key file \"%s\"",
filename_to_str(s->keyfile));
keytype = key_type(s->keyfile);
if (keytype == SSH_KEYTYPE_SSH2 ||
@ -798,7 +798,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
s->cur_prompt->to_server = false;
s->cur_prompt->name = dupstr("SSH key passphrase");
add_prompt(s->cur_prompt,
dupprintf("Passphrase for key \"%.100s\": ",
dupprintf("Passphrase for key \"%s\": ",
s->publickey_comment),
false);
s->userpass_ret = seat_get_userpass_input(