mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
sesschan.c: use dupprintf in place of snprintf.
I hadn't actually realised until now that the SSH server code is now being compiled on Windows! It happened because I've been using static libraries internally to the build organisation: of course, CMake has no way of knowing that those libraries are only needed _within_ the build, and for all it knows they might be end products shipped to users to link their own applications with. So all the objects in the 'sshserver' library will now be compiled, even on Windows, where no applications actually link with it. And in that context, the use of snprintf caused a compiler warning from the w32old build, because there, snprintf doesn't exist in the older version of the C library. Of course, it's currently benign, because no application in the w32old build (or any other Windows build) is actually linking again the sshserver library. But I don't want to rule it out in future, or at least not for a trivial reason like this. So I've fixed the warning in the simplest way, by switching to our own dupprintf, which is available everywhere.
This commit is contained in:
parent
970f374ea6
commit
b1d2f96823
@ -400,13 +400,10 @@ bool sesschan_enable_x11_forwarding(
|
||||
sesschan *sess = container_of(chan, sesschan, chan);
|
||||
strbuf *authdata_bin;
|
||||
size_t i;
|
||||
char screensuffix[32];
|
||||
|
||||
if (oneshot)
|
||||
return false; /* not supported */
|
||||
|
||||
snprintf(screensuffix, sizeof(screensuffix), ".%u", screen_number);
|
||||
|
||||
/*
|
||||
* Decode the authorisation data from ASCII hex into binary.
|
||||
*/
|
||||
@ -430,11 +427,14 @@ bool sesschan_enable_x11_forwarding(
|
||||
|
||||
sess->xfwd_plug.vt = &xfwd_plugvt;
|
||||
|
||||
char *screensuffix = dupprintf(".%u", screen_number);
|
||||
|
||||
sess->n_x11_sockets = platform_make_x11_server(
|
||||
&sess->xfwd_plug, appname, 10, screensuffix,
|
||||
authproto, ptrlen_from_strbuf(authdata_bin),
|
||||
sess->x11_sockets, sess->conf);
|
||||
|
||||
sfree(screensuffix);
|
||||
strbuf_free(authdata_bin);
|
||||
return sess->n_x11_sockets != 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user