ec_cleanup frees every curve ecc-ssh.c sets up except Ed448: ec_ed448 lacks
the WINSCP_CURVE_CLEANUP its siblings have and ec_cleanup does not call it,
so its points and bignums leak at shutdown once an Ed448 key was used.
win_misc_cleanup frees get_system_dir's cached buffer but leaves the pointer
and its size, so a get_system_dir call after the cleanup returns freed
memory instead of fetching the directory again.
random_add_noise enters putty_section and then returns without leaving it
when the generator is not active. The section is recursive, so the thread
that returned keeps working, but any other thread entering it -- another
session's socket, RNG or bignum code -- then blocks for good.
aes-ni.c pushes its target attribute under #ifdef __clang__ but pops it
under #ifdef _WIN64. For clang targeting Win64 the two coincide. Otherwise
they do not: clang targeting 32-bit Windows (clang-cl in a WINSCP_VS build)
reports the push as unterminated and fails, and MSVC targeting x64 meets a
pop of a clang pragma it does not know (warning C4068). The pop now has the
push's condition.
This prevents a couple of different possible crashes if a PPK file
constructed by something other than PuTTYgen contains invalid
parameters. If parallelism is 0 then the Argon2 code can divide by
zero; if the memory requirement is too small for the parallelism then
it can overrun a buffer.
Signed-off-by: Martin Prikryl <martin@winscp.net>
Source commit: e66db8e4bd600fd9d92467fb8b6cc31cd86fc0ad
This case led to a tight loop in ssh2_try_send, which would calculate
the largest size of data packet it could send on a channel as the min
of various things including the max packet size; find, of course, that
the largest size was therefore 0; send no data; and loop round again
to keep trying.
There's nothing you can sensibly do about that by the time you get to
ssh2_try_send, so a better response is to reject the connection at
open time.
When the connection is initiated from the far end (i.e. we receive
CHANNEL_OPEN) we can do this relatively nondestructively, by rejecting
just that one channel-open request. When it's initiated from our end,
and the CHANNEL_OPEN_CONFIRMATION we got back contained the zero
maxpkt, there's no similar protocol method for rejecting the
confirmation, so instead we disconnect the whole SSH session.
(That seems harsh, but I think it's reasonable, because one reason for
aborting an SSH connection is that you genuinely don't _know_ what
your client can legally do next – and this is exactly that situation.)
Signed-off-by: Martin Prikryl <martin@winscp.net>
Source commit: 5b7de97f5fcb3f4b957e9585ea15018831c8b547
The space allocated for the decrypted packet was 4 bytes too small,
because we end up reading (s->packetlen + s->maclen) bytes into it,
but we allocated the buffer based on the largest possible size of
(s->len + s->maclen). The two differ by 4. So if a packet is within 4
bytes of the largest size accepted by the check of s->len against
OUR_V2_PACKETLIMIT, then it overruns the buffer allocated for the
following BPP_READ.
Thanks to Yukihiro Nakamura for spotting this.
Signed-off-by: Martin Prikryl <martin@winscp.net>
Source commit: dc1ea030899bc7ec7ed4388cfc01757c41816f0c
And adding it to a project file for consistency and 64-bit compatibility (for which it will be compiled by bcc64)
Source commit: edc84e36955a053c777b9ebedca5b6a354dc202e
Primarily because linking MSVC object files to Clang executable do not seem to be possible anymore.
But there's even 25% boost comparing to MSVC for SHA-256 and AES SW (Argon not measured)
AES NI won't compile without huge changes (alignment, partial reimplementation in asm), which hopefully won't be needed on 64-bit (and inline asm is allegedly not even possible with 64-bit Clang).
So sticking with MSVC for now.
With the changes similar boost as with Clang. Though -O3 optimization (BCC_OptimizeMaximum) was needed. Without it, the speed was 10x slower.
Source commit: 07d16b2a5ebf3b166af572a76fdbab6c488cc00f
Most, if not all, were for compatibility with the classic C++Builder compiler (declarations in the middle of code + inline structure initializers)
Source commit: a9f38c3a07777e538c3c6e0fbdd38e9d68327dfa
with aim to eventually update the code to need as little warnings disabled as needed.
Some code updates (and even fixes) to avoid warning done already
Source commit: 5c45a6f56c52e7b0c5034ed9980cd65259a7372b
Mostly:
– incorrectly identified uninitialized variables
– explicit static global variables
– const, sign and down casts and safety
– typename use
– semicolon after function implementation
– unused variables, fields, arguments and macros
– field initialization order
– exact include filename case
– redundant in code macros already defined at project level
(cherry picked from commit f7f00c631e)
Source commit: 90ad9390853aba308abe73cf02e0281238c53c87
Notably:
Bug fix: Monospace font is not remembered if SSH banners are administratively forced
Change: Bug fix: In XML log, filename tag was included in stat tag, although explicitly documented not to
(cherry picked from commit 4019b56ffb)
Source commit: 8f8d10bc0c9f4ca626dceda1d3e9889dc22f4394