1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 17:47:33 -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

@ -113,7 +113,7 @@ void ssh2_bpp_new_outgoing_crypto(
(ssh2_cipher_alg(s->out.cipher)->flags & SSH_CIPHER_IS_CBC) &&
!(s->bpp.remote_bugs & BUG_CHOKES_ON_SSH2_IGNORE));
bpp_logevent("Initialised %.200s outbound encryption",
bpp_logevent("Initialised %s outbound encryption",
ssh2_cipher_alg(s->out.cipher)->text_name);
} else {
s->out.cipher = NULL;
@ -124,7 +124,7 @@ void ssh2_bpp_new_outgoing_crypto(
s->out.mac = ssh2_mac_new(mac, s->out.cipher);
mac->setkey(s->out.mac, mac_key);
bpp_logevent("Initialised %.200s outbound MAC algorithm%s%s",
bpp_logevent("Initialised %s outbound MAC algorithm%s%s",
ssh2_mac_alg(s->out.mac)->text_name,
etm_mode ? " (in ETM mode)" : "",
(s->out.cipher &&
@ -176,7 +176,7 @@ void ssh2_bpp_new_incoming_crypto(
ssh2_cipher_setkey(s->in.cipher, ckey);
ssh2_cipher_setiv(s->in.cipher, iv);
bpp_logevent("Initialised %.200s inbound encryption",
bpp_logevent("Initialised %s inbound encryption",
ssh2_cipher_alg(s->in.cipher)->text_name);
} else {
s->in.cipher = NULL;
@ -186,7 +186,7 @@ void ssh2_bpp_new_incoming_crypto(
s->in.mac = ssh2_mac_new(mac, s->in.cipher);
mac->setkey(s->in.mac, mac_key);
bpp_logevent("Initialised %.200s inbound MAC algorithm%s%s",
bpp_logevent("Initialised %s inbound MAC algorithm%s%s",
ssh2_mac_alg(s->in.mac)->text_name,
etm_mode ? " (in ETM mode)" : "",
(s->in.cipher &&