Fix an always-false if statement which was causing the window border
not to be redrawn when the user reconfigured the background colour.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9917 cda61777-01e9-0310-a592-d414129be87e
Tighten up a lot of casts from unsigned to int which are read by one
of the GET_32BIT macros and then used as length fields. Missing bounds
checks against zero have been added, and also I've introduced a helper
function toint() which casts from unsigned to int in such a way as to
avoid C undefined behaviour, since I'm not sure I trust compilers any
more to do the obviously sensible thing.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9918 cda61777-01e9-0310-a592-d414129be87e
Fix another giant batch of resource leaks. (Mostly memory, but there's
one missing fclose too.)


git-svn-id: svn://svn.tartarus.org/sgt/putty@9919 cda61777-01e9-0310-a592-d414129be87e
Add a missing null pointer check in wc_unescape, to bring it in line
with the usage comment saying you're allowed to pass NULL to find out
only the return value. No caller actually does pass NULL at the
moment.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9920 cda61777-01e9-0310-a592-d414129be87e
Move the calculation of the exchange hash to above the various
warnings about insecure crypto components. The latter may crReturn
(though not in any current implementation, I believe), which
invalidates pktin, which is used by the former.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9921 cda61777-01e9-0310-a592-d414129be87e
Add an extended version of ctrl_alloc which permits you to provide a
custom free function, in case you need to ctrl_alloc a structure which
then has additional dynamically allocated things dangling off it.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9922 cda61777-01e9-0310-a592-d414129be87e
Use the new ctrl_alloc_with_free to clean up a long-standing FIXME in
the session saving code, in which the contents of the edit box giving
the current saved session name was stored in a horrid place with a
fixed length. Now it's dangling off sessionsaver_data as it always
ought to have been, and it's dynamically reallocated to the
appropriate length, and there's a free function that cleans it up at
the end of the dialog's lifetime.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9923 cda61777-01e9-0310-a592-d414129be87e
Remove a return path from sshcom_write() which was both unreachable
(it would trigger if !type==RSA and !type==DSA, but one of those must
have been true to get there in the first place) and erroneous (it
would return NULL without going through the cleanup code). Since the
code's internal structure guarantees that path isn't reached, replace
it with an assert.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9924 cda61777-01e9-0310-a592-d414129be87e
Remove a pointless assignment in setup_config_box.


git-svn-id: svn://svn.tartarus.org/sgt/putty@9925 cda61777-01e9-0310-a592-d414129be87e
Remove a redundant while-loop condition when reading RFC822-style
header text from a PuTTY key file.

(It's silly to have both while (len > 0) at the top of the loop _and_
an if (len == 0) return in the middle, and in fact the former was the
erroneous one since it would have prohibited a 39-character header,
which I intended to be permitted.)


git-svn-id: svn://svn.tartarus.org/sgt/putty@9926 cda61777-01e9-0310-a592-d414129be87e