simon-git: putty (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Dec 1 17:16:04 GMT 2018
TL;DR:
b2078a3c Add a missing initialisation.
915be1f6 testbn: add a missing initialisation in argument setup.
4251d28f Replace several ad-hoc string formatters with strbuf.
dbb2c003 Use strbuf and BinarySource for scrollback compression.
144b738f pscp, psftp: use a bufchain in ssh_scp_recv.
d2ff9482 Mark a few functions as __attribute__((noreturn)).
b54147de Remove some redundant variables and assignments.
e9b49fdc psftp: stop checking the return of canonify() for NULL.
1e1f06b2 Check by assertion that we cross-certified the right key type.
66b776ae Add some more miscellaneous asserts.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2018-12-01 17:16:04
commit b2078a3c51f73d8514754924c52c76c2dda25468
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b2078a3c51f73d8514754924c52c76c2dda25468;hp=1074a9be4ce66ce4ca05d6698e563c42c62b5f10
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 10:11:24 2018 +0000
Add a missing initialisation.
The variable 'toret' in ssh2_transport_get_specials would have been
returned while uninitialised in the case where neither of the if
statements in the function set it to true.
ssh2transport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 915be1f6f0c50f81f50630be8acb61959a957e7e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=915be1f6f0c50f81f50630be8acb61959a957e7e;hp=b2078a3c51f73d8514754924c52c76c2dda25468
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 14:13:51 2018 +0000
testbn: add a missing initialisation in argument setup.
The code that parses hexadecimal test arguments out of test lines
writes them into a buffer in binary form, and sets ptrs[i] to be the
starting point of each argument. The idea is that ptrs[i+1]-ptrs[i] is
the length of each argument - but for that to apply to the _final_
argument, we need to have set one final element in ptrs[], which I
forgot to do.
testbn.c | 3 +++
1 file changed, 3 insertions(+)
commit 4251d28f715189622a1c86f2eb8e9fab2897587d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4251d28f715189622a1c86f2eb8e9fab2897587d;hp=915be1f6f0c50f81f50630be8acb61959a957e7e
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 09:35:52 2018 +0000
Replace several ad-hoc string formatters with strbuf.
uxnet.c's sk_namelookup and the sorting-key construction in
pangofont_enum_fonts() were both using s[n]printf and strncpy into
buffers that had no real need to be fixed-size; format_telnet_command
and the GTK Event Log selection-data builder were doing their own
sresize loops, but now we have strbuf they can just use that and save
redoing the same work.
proxy.c | 98 ++++++++++++++--------------------------------------------
unix/gtkdlg.c | 41 +++++-------------------
unix/gtkfont.c | 34 ++++++++++----------
unix/uxnet.c | 21 +++++++------
4 files changed, 60 insertions(+), 134 deletions(-)
commit dbb2c0030a0a40895b0b834e23f9a890c0b254d1
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=dbb2c0030a0a40895b0b834e23f9a890c0b254d1;hp=4251d28f715189622a1c86f2eb8e9fab2897587d
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 10:25:46 2018 +0000
Use strbuf and BinarySource for scrollback compression.
'struct str' in terminal.c was an earlier and less good implementation
of the same concept as misc.h's strbuf, so I've replaced it with the
same strbuf we have everywhere. As a bonus, this means I can also use
put_uint{16,32} to save a bit of effort writing out the compressed
scrollback data.
On the decompression side, I've also switched to using BinarySource,
which has the advantage that now if the decoding goes wrong we can at
least be sure of not reading beyond the end of the buffer.
(The flip side of that is that now we _store_ the length of each
compressed line buffer, which costs a bit of memory. But I think it's
worth it for the safety and code consistency.)
terminal.c | 230 ++++++++++++++++++++++++++++---------------------------------
1 file changed, 104 insertions(+), 126 deletions(-)
commit 144b738f31d53871dcb7ac95a9c1412cff5d76b7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=144b738f31d53871dcb7ac95a9c1412cff5d76b7;hp=dbb2c0030a0a40895b0b834e23f9a890c0b254d1
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 09:56:32 2018 +0000
pscp, psftp: use a bufchain in ssh_scp_recv.
The ad-hoc code that received data from the SCP or SFTP server
predated even not-very-modern conveniences such as bufchain, and was
quite horrible and cumbersome.
Particularly nasty was the part where ssh_scp_recv set a _global_
pointer variable to the buffer it was in the middle of writing to, and
then recursed and expected a callback to use that pointer. That caused
clang-analyzer to grumble at me, in a particular case where the output
buffer was in the ultimate caller's stack frame; even though I'm
confident the code _worked_, I can't blame clang for being unhappy!
So now we do things the modern and much simpler way: the callback when
data comes in just puts it on a bufchain, and the top-level
ssh_scp_recv repeatedly waits until data arrives in the bufchain and
then copies it to the output buffer.
misc.c | 9 ++++++++
misc.h | 1 +
pscp.c | 71 +++++++++++++-------------------------------------------------
psftp.c | 74 +++++++++++------------------------------------------------------
4 files changed, 36 insertions(+), 119 deletions(-)
commit d2ff9482073294632d936e89c0eca59591bf872d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d2ff9482073294632d936e89c0eca59591bf872d;hp=144b738f31d53871dcb7ac95a9c1412cff5d76b7
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 10:33:08 2018 +0000
Mark a few functions as __attribute__((noreturn)).
This is mostly to make static analysers and compiler warnings a bit
happier - now they know that a call to, say, modalfatalbox() means
they don't have to worry about what the rest of the function will do.
defs.h | 6 ++++++
pscp.c | 2 +-
putty.h | 7 ++-----
3 files changed, 9 insertions(+), 6 deletions(-)
commit b54147de4b12097f00a5bbebb684a3a235dfcb8f
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b54147de4b12097f00a5bbebb684a3a235dfcb8f;hp=d2ff9482073294632d936e89c0eca59591bf872d
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 14:06:44 2018 +0000
Remove some redundant variables and assignments.
This fixes a batch of clang-analyzer warnings of the form 'you
declared / assigned this variable and then never use it'. It doesn't
fix _all_ of them - some are there so that when I add code in the
future _it_ can use the variable without me having to remember to
start setting it - but these are the ones I thought it would make the
code better instead of worse to fix.
config.c | 2 +-
sshaes.c | 8 +++-----
tree234.c | 7 ++-----
unix/gtkcols.c | 6 +-----
unix/uxnet.c | 1 -
unix/uxpgnt.c | 6 +++---
unix/uxplink.c | 6 +++---
unix/uxserver.c | 6 +++---
unix/uxsftp.c | 6 +++---
9 files changed, 19 insertions(+), 29 deletions(-)
commit e9b49fdceddb921340d6f21c60b0c9239728a878
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e9b49fdceddb921340d6f21c60b0c9239728a878;hp=b54147de4b12097f00a5bbebb684a3a235dfcb8f
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 14:07:03 2018 +0000
psftp: stop checking the return of canonify() for NULL.
It hasn't been possible for canonify() to return a null pointer since
commit 094dd30d9, in 2001. But the whole of psftp.c is full of error
checking clauses that allow for the possibility that it might!
psftp.c | 46 ----------------------------------------------
1 file changed, 46 deletions(-)
commit 1e1f06b2ecb95bfa04a38c4cfe43413df9d30671
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=1e1f06b2ecb95bfa04a38c4cfe43413df9d30671;hp=e9b49fdceddb921340d6f21c60b0c9239728a878
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 14:39:23 2018 +0000
Check by assertion that we cross-certified the right key type.
The flag 'cross_certifying' in the SSH-2 transport layer state is now
a pointer to the host key algorithm we expect to be certifying,
instead of a plain bool. That lets me check by assertion that it's
what we expected it to be after all the complicated key exchange has
happened.
(I have no reason to think this _will_ go wrong. When we cross-
certify, the desired algorithm should be the only one we put into our
KEXINIT host key algorithm list, so it should also be the only one we
can come out of the far end of KEXINIT having selected. But if
anything ever does go wrong with my KEXINIT handling then I'd prefer
an assertion failure to silently certifying the wrong key, and also,
this makes it clearer to static analysers - and perhaps also humans
reading the code - what we expect the situation to be.)
ssh2kex-client.c | 5 ++++-
ssh2transport.c | 3 +--
ssh2transport.h | 8 +++++---
3 files changed, 10 insertions(+), 6 deletions(-)
commit 66b776ae6e177049486676b404b7ffdae3756768
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=66b776ae6e177049486676b404b7ffdae3756768;hp=1e1f06b2ecb95bfa04a38c4cfe43413df9d30671
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Dec 1 14:13:37 2018 +0000
Add some more miscellaneous asserts.
These clarify matters for static checkers (not to mention humans), and
seem inexpensive enough not to worry about adding.
settings.c | 1 +
sshcrcda.c | 1 +
unix/gtkcols.c | 2 ++
unix/gtkdlg.c | 3 ++-
unix/gtkfont.c | 1 +
5 files changed, 7 insertions(+), 1 deletion(-)
More information about the tartarus-commits
mailing list