1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

GUI PuTTY: fix format-string goof on connect failure.

Introduced by 61f3e3e29, as part of my periodic efforts to make the
GTK front end work usefully on OS X: the 'Unable to open connection to
[host]: [error]' message box is accidentally passed through two layers
of printf format-string parsing, the second of which has no argument
list. So if you pass in a host name like '%s' on the command line,
bad things will happen when that error message is constructed.

This happened because in that commit I changed a call to
fatal_message_box() into a call to connection_fatal(), without
noticing that the latter was printf-style variadic and the former
wasn't. On the plus side, that means now I can remove the explicit
dupprintf/free around the error message.
This commit is contained in:
Simon Tatham 2019-05-15 15:04:02 +01:00
parent 70fd577e40
commit 921613ff08

View File

@ -5085,11 +5085,10 @@ static void start_backend(GtkFrontend *inst)
conf_get_bool(inst->conf, CONF_tcp_keepalives));
if (error) {
char *msg = dupprintf("Unable to open connection to %s:\n%s",
seat_connection_fatal(&inst->seat,
"Unable to open connection to %s:\n%s",
conf_dest(inst->conf), error);
inst->exited = true;
seat_connection_fatal(&inst->seat, msg);
sfree(msg);
return;
}