Граф коммитов

3670 Коммитов

Автор SHA1 Сообщение Дата
Simon Tatham cb1df53360 Make modinv able to return NULL if its inputs are not coprime, and
check for that return value everywhere it is used.

[originally from svn r9990]
2013-08-04 19:34:07 +00:00
Simon Tatham 9c054cf467 Avoid trying to take the modular inverse of zero in response to a
sufficiently silly DSA signature.

[originally from svn r9989]
2013-08-04 19:34:00 +00:00
Simon Tatham bf9b9224d8 Another couple of memory leaks.
[originally from svn r9988]
2013-08-04 19:33:57 +00:00
Simon Tatham 5bcb8d6aac More consistently defend against division by zero with assertions. We
now check that all the modular functions (modpow, modinv, modmul,
bigdivmod) have nonzero moduli, and that modinv also has a nonzero
thing to try to invert.

[originally from svn r9987]
2013-08-04 19:33:53 +00:00
Simon Tatham 76dc7c49a2 Validate newly created DSA keys more carefully. Don't want a structure
half-filled with null pointers.

[originally from svn r9986]
2013-08-04 19:33:49 +00:00
Simon Tatham 4b1fcc8ba2 Remove some redundant null-pointer checks from code that must have
been written before I wrote a never-failing snew.

[originally from svn r9985]
2013-08-04 19:33:46 +00:00
Simon Tatham 8041377799 Sanitise freeing of DSA keys.
[originally from svn r9984]
2013-08-04 19:33:43 +00:00
Simon Tatham ba49faec3d Reinstate a piece of code accidentally removed in r9214, where Windows
PuTTY does not trim a colon suffix off the hostname if it contains
_more than one_ colon. This allows IPv6 literals to be entered.

(Really we need to do a much bigger revamp of all uses of hostnames to
arrange that square-bracketed IPv6 literals work consistently, but
this at least removes a regression over 0.62.)

[originally from svn r9983]
[r9214 == a1f3b7a358]
2013-08-04 19:32:10 +00:00
Simon Tatham fd266a3cec Raise the default scrollback from 200 to 2000 lines. The former was
not so silly in the 1990s and before I implemented scrollback
compression, but it's been a ridiculously low default for a while now.

[originally from svn r9982]
2013-08-02 22:33:40 +00:00
Simon Tatham 55e8a268ab Found a lot of places in sshbn.c where for-loops zeroing out memory
just before freeing it really ought to be smemclrs.

[originally from svn r9981]
2013-08-02 19:51:36 +00:00
Simon Tatham 493a333078 Verify RSA keys created by rsa2_openssh_createkey.
[originally from svn r9980]
2013-08-02 06:28:05 +00:00
Simon Tatham 2e0723e9ef Replace some 'sfree' calls of bignums with the proper 'freebn'.
[originally from svn r9979]
2013-08-02 06:28:00 +00:00
Simon Tatham 6184e9f95d Add some missing bounds checks in signature verification routines.
[originally from svn r9978]
2013-08-02 06:27:56 +00:00
Simon Tatham e01104f899 Fix an array-size bug in modmul, and add some tests for it.
[originally from svn r9977]
2013-08-02 06:27:54 +00:00
Simon Tatham a777103fd9 Remove one of the frees added in r9916. stat_name points to somewhere
within the same string that destfname points to the start of, so
freeing it causes at best a double-free of destfname and more likely a
free of something that isn't even the start of an allocated block.

[originally from svn r9974]
[r9916 == cc4f38df14]
2013-07-29 17:47:33 +00:00
Simon Tatham 808df44e54 Add an assortment of missing consts I've just noticed.
[originally from svn r9972]
2013-07-27 18:35:48 +00:00
Simon Tatham a5fd6ad272 Get rid of the variable 'advapi' in Pageant's WinMain, which was never
actually used for anything sensible and could have been freed while
containing nonsense at program end.

[originally from svn r9971]
2013-07-24 19:18:06 +00:00
Simon Tatham 6ede5c473a Back out r9964. I wasn't paying attention: every control is in the
byid tree but not all of them are in the byctrl tree.

[originally from svn r9970]
[r9964 == b3afa10aa7]
2013-07-22 19:56:04 +00:00
Simon Tatham 3b278a95f8 Add a bob script to do Coverity scanning.
[originally from svn r9969]
2013-07-22 19:56:00 +00:00
Simon Tatham eb19a35a3d Fix a few more memory and resource leaks.
[originally from svn r9968]
2013-07-22 19:55:55 +00:00
Simon Tatham e5d3a353cc Remove the variable 'bufused', which came over from winnet.c in
mistaken cut and paste and is just a bug.

[originally from svn r9967]
2013-07-22 19:55:53 +00:00
Simon Tatham 5e2c794424 Increase FONT_MAXNO from 0x2f to 0x40, to ensure the fonts[] array
includes every possible combination of the font bitfields, in
particular ATTR_OEM|ATTR_NARROW.

[originally from svn r9966]
2013-07-22 07:12:31 +00:00
Simon Tatham 81a11efdaf Correct an inequality sign causing the bounds check in Windows
palette_set() to be bogus. Fortunately, this isn't exploitable through
the terminal emulator, because the palette escape sequence parser
contains its own bounds check before even calling palette_set().

While I'm at it, fix the same goof in the OS X version! That port is
more or less abandoned, but that's no excuse for leaving obviously
wrong code lying around.

[originally from svn r9965]
2013-07-22 07:12:26 +00:00
Simon Tatham b3afa10aa7 Missing assert.
[originally from svn r9964]
2013-07-22 07:12:21 +00:00
Simon Tatham 0a26bd74e1 Replace the type-checking COMPTR macro with my current idea of best
practice in type-check macros.

[originally from svn r9963]
2013-07-22 07:12:15 +00:00
Simon Tatham 353b85be67 Add missing casts in arguments to ctype functions.
[originally from svn r9962]
2013-07-22 07:12:10 +00:00
Simon Tatham 61e555ec79 Rationalise null pointer checks in both decode_codepage functions, so
that decode_codepage(NULL) and decode_codepage("") both return the
default character set.

[originally from svn r9961]
2013-07-22 07:12:05 +00:00
Simon Tatham f9f93584c2 Fix a double error handling goof in the winstore side of the jump list
support: transform_jumplist_registry should give its caller
dynamically allocated data if and only if it returns JUMPLISTREG_OK,
and get_jumplist_registry_entries should test the return value against
JUMPLISTREG_OK rather than a value from a totally different enum.

[originally from svn r9960]
2013-07-22 07:11:58 +00:00
Simon Tatham b99bec3b02 Another big batch of memory leak fixes, again mostly on error paths.
The most interesting one is printer_add_enum, which I've modified to
take a char ** rather than a char * so that it can both realloc its
input buffer _and_ return NULL to indicate error.

[originally from svn r9959]
2013-07-22 07:11:54 +00:00
Simon Tatham 4c61cb20a1 Add a missing null pointer check in one of the dialog box functions.
[originally from svn r9958]
2013-07-22 07:11:48 +00:00
Simon Tatham 888804eef7 Report an error if deleting a random seed file fails.
(This has also required me to add a currently unused nonfatal() to
PuTTYgen, since although PuTTYgen won't actually try to delete
putty.rnd, it does link in winstore.c as a whole.)

[originally from svn r9957]
2013-07-22 07:11:44 +00:00
Simon Tatham 54693d4079 Invent a win_strerror() function which behaves as much like Unix
strerror as I can arrange, wrapping up all the ugly FormatMessage
nonsense and caching previously looked-up messages for reuse so that
callers can treat them as static.

[originally from svn r9956]
2013-07-22 07:11:39 +00:00
Simon Tatham 13667de106 Rework keylist_update() to fix both a buffer-size limitation and a
memory leak.

[originally from svn r9955]
2013-07-22 07:11:35 +00:00
Simon Tatham da052d88f8 Initialise 'psa' to NULL on every code path in the Pageant client
code, fixing a potential segfault when compiling with -DNO_SECURITY.

[originally from svn r9954]
2013-07-21 11:01:22 +00:00
Simon Tatham eaea69ef53 If the SSH server sends us CHANNEL_CLOSE for a channel on which we're
sitting on a pile of buffered data waiting for WINDOW_ADJUSTs, we
should throw away that buffered data, because the CHANNEL_CLOSE tells
us that we won't be receiving those WINDOW_ADJUSTs, and if we hang on
to the data and keep trying then it'll prevent ssh_channel_try_eof
from sending the CHANNEL_EOF which is a prerequisite of sending our
own CHANNEL_CLOSE.

[originally from svn r9953]
2013-07-21 10:12:58 +00:00
Simon Tatham 4f457ff7f2 Add '.so' to the list of file extensions cleared up by 'make clean' in
Makefile.cyg, since if you're building against Winelib it will
generate one of those alongside each .exe file.

[originally from svn r9952]
2013-07-21 09:16:37 +00:00
Simon Tatham 7426b8f215 Completely remove the 'frozen_readable' mechanism from uxnet.c. It
parallels a similar mechanism in winnet.c and came over by copy and
paste, but is pointless in the Unix networking API.

On Windows, if you're using a mechanism such as WSAAsyncSelect which
delivers readability notifications as messages rather than return
values from a system call, you only get notified that a socket is
readable once - it remembers that it's told you, and doesn't tell you
again until after you've done a read. So in the case where we
intentionally stop reading from a socket because our local buffer is
full, and later want to start reading again, we do a read from the
socket with MSG_PEEK set, and that clears Windows's flag and tells it
to start sending us readability notifications again.

On Unix, select() and friends didn't do anything so strange in the
first place, so the whole mechanism is unnecessary.

[originally from svn r9951]
2013-07-21 07:40:36 +00:00
Simon Tatham 77791de4e1 Fix error checking in uxstore.c: add a missing check, and fix a
mis-cut-and-pasted one.

[originally from svn r9950]
2013-07-21 07:40:30 +00:00
Simon Tatham f1d6fa4712 When I turned fcntls into noncloexecs in r9940, I missed one.
[originally from svn r9949]
[r9940 == b426872219]
2013-07-21 07:40:28 +00:00
Simon Tatham 08d46fca51 Two more memory leak fixes, on error paths I didn't spot in r9919.
[originally from svn r9948]
[r9919 == ea301bdd9b]
2013-07-21 07:40:26 +00:00
Simon Tatham 1073d229ae Fix a null-dereference introduced by another mis-fix in r9919.
[originally from svn r9946]
[r9919 == ea301bdd9b]
2013-07-20 13:15:20 +00:00
Simon Tatham adf8b3222f Fix leak of 'fname' introduced by the rewrite of write_random_seed in
r9933.

[originally from svn r9945]
[r9933 == 2854ae1f33]
2013-07-20 13:15:16 +00:00
Simon Tatham 01ead8590b Another two mis-fixes from r9919: when we sfree(line) on exit from the
ssh.com and OpenSSH key import loops, we should also null it out so
that the cleanup path doesn't try to re-free the same pointer.

[originally from svn r9944]
[r9919 == ea301bdd9b]
2013-07-20 13:15:11 +00:00
Simon Tatham 3af26af19e Redo a mis-fix of a memory leak in r9919: I added sfree(data)
immediately after conf_deserialise in the Duplicate Session receiver,
whereas I should have put it after the subsequent loop that extracts
the pty argv if any.

[originally from svn r9943]
[r9919 == ea301bdd9b]
2013-07-20 13:15:10 +00:00
Simon Tatham c46fc37ebc Switch to translating keystrokes using ToUnicodeEx rather than
ToAsciiEx, where possible.

This enables support for keys which generate Unicode characters that
aren't in the system code page, which seems to me like a perverse way
for Windows to have set up the system code page but apparently does
happen, e.g. (I'm told) U+0219 and U+021B on Romanian keyboards.

Patch mostly due to Andrei Damian-Fekete.

[originally from svn r9942]
2013-07-20 11:31:24 +00:00
Simon Tatham 8902fef445 Been meaning to get round to this for a while: use CryptGenRandom to
gather extra entropy at Windows PuTTY startup time. (It's only used as
one of the inputs to PuTTY's internal entropy pool, so nobody is
required to trust it.)

[originally from svn r9941]
2013-07-20 08:34:54 +00:00
Simon Tatham b426872219 Centralise calls to fcntl into functions that carefully check the
error returns.

[originally from svn r9940]
2013-07-19 18:10:02 +00:00
Simon Tatham 96f3589e16 Add an error check to every setsockopt call in uxnet.c.
[originally from svn r9939]
2013-07-19 17:45:01 +00:00
Simon Tatham 8966f7c1ea Add some conditionally-compilable diagnostics to the RNG. I got
briefly worried that it might not be doing what I thought it was
doing, but examining these diagnostics shows that it is after all, and
now I've written them it would be a shame not to keep them for future
use.

[originally from svn r9938]
2013-07-19 17:44:58 +00:00
Simon Tatham 407fd7b9ab Better error reporting when failing to save a session.
[originally from svn r9937]
2013-07-19 17:44:53 +00:00