Skip to content
Snippets Groups Projects
  1. Oct 01, 2014
    • Simon Tatham's avatar
      Turn mkunxarc.sh back into an ordinary sh script. · 4c49e29b
      Simon Tatham authored
      It became bash-dependent in r9229 because I used a bashism to remove
      the 'r' from the front of $SVN_REV, but that's not needed any more.
      
      [originally from svn r10281]
      [r9229 == bd60f2fc]
      4c49e29b
    • Simon Tatham's avatar
      Add a missing bounds check in the Deflate decompressor. · 3fd8014e
      Simon Tatham authored
      The symbol alphabet used for encoding ranges of backward distances in
      a Deflate compressed block contains 32 symbol values, but two of them
      (symbols 30 and 31) have no meaning, and hence it is an encoding error
      for them to appear in a compressed block. If a compressed file did so
      anyway, this decompressor would index past the end of the distcodes[]
      array. Oops.
      
      This is clearly a bug, but I don't believe it's a vulnerability. The
      nonsense record we load from distcodes[] in this situation contains an
      indeterminate bogus value for 'extrabits' (how many more bits to read
      from the input stream to complete the backward distance) and also for
      the offset to add to the backward distance after that. But neither of
      these can lead to a buffer overflow: if extrabits is so big that
      dctx->nbits (which is capped at 32) never exceeds it, then the
      decompressor will simply swallow all further data without producing
      any output, and otherwise the decompressor will consume _some_ number
      of spare bits from the input, work out a backward distance and an
      offset in the sliding window which will be utter nonsense and probably
      out of bounds, but fortunately will then AND the offset with 0x7FFF at
      the last minute, which makes it safe again. So I think the worst that
      a malicious compressor can do is to cause the decompressor to generate
      strange data, which of course it could do anyway if it wanted to by
      sending that same data legally compressed.
      
      [originally from svn r10278]
      3fd8014e
  2. Sep 24, 2014
    • Simon Tatham's avatar
      Rework versioning system to not depend on Subversion. · 4d8782e7
      Simon Tatham authored
      I've shifted away from using the SVN revision number as a monotonic
      version identifier (replacing it in the Windows version resource with
      a count of days since an arbitrary epoch), and I've removed all uses
      of SVN keyword expansion (replacing them with version information
      written out by Buildscr).
      
      While I'm at it, I've done a major rewrite of the affected code which
      centralises all the computation of the assorted version numbers and
      strings into Buildscr, so that they're all more or less alongside each
      other rather than scattered across multiple source files.
      
      I've also retired the MD5-based manifest file system. A long time ago,
      it seemed like a good idea to arrange that binaries of PuTTY would
      automatically cease to identify themselves as a particular upstream
      version number if any changes were made to the source code, so that if
      someone made a local tweak and distributed the result then I wouldn't
      get blamed for the results. Since then I've decided the whole idea is
      more trouble than it's worth, so now distribution tarballs will have
      version information baked in and people can just cope with that.
      
      [originally from svn r10262]
      4d8782e7
    • Jacob Nevins's avatar
      Correct man page description of -hostkey to match actual behaviour. · 725696f1
      Jacob Nevins authored
      [originally from svn r10235]
      725696f1
  3. Sep 23, 2014
    • Simon Tatham's avatar
      Bodge around the failing Coverity build in winshare.c. · e11f8ee7
      Simon Tatham authored
      The winegcc hack I use for my Coverity builds is currently using a
      version of wincrypt.h that's missing a couple of constants I use.
      Ensure they're defined by hand, but (just in case I defined them
      _wrong_) also provide a command-line define so I can do that only in
      the case of Coverity builds.
      
      [originally from svn r10234]
      e11f8ee7
  4. Sep 21, 2014
  5. Sep 09, 2014
    • Jacob Nevins's avatar
      Fix a FIXME and a markup error in the manual host key docs. · 25ea76da
      Jacob Nevins authored
      [originally from svn r10224]
      25ea76da
    • Simon Tatham's avatar
      Change the naming policy for connection-sharing Unix sockets. · 24cd95b6
      Simon Tatham authored
      I had initially assumed that, since all of a user's per-connection
      subdirectories live inside a top-level putty-connshare.$USER directory
      that's not accessible to anyone else, there would be no need to
      obfuscate the names of the internal directories for privacy, because
      nobody would be able to look at them anyway.
      
      Unfortunately, that's not true: 'netstat -ax' run by any user will
      show up the full pathnames of Unix-domain sockets, including pathname
      components that you wouldn't have had the access to go and look at
      directly. So the Unix connection sharing socket names do need to be
      obfuscated after all.
      
      Since Unix doesn't have Windows's CryptProtectMemory, we have to do
      this manually, by creating a file of random salt data inside the
      top-level putty-connshare directory (if there isn't one there already)
      and then hashing that salt with the "user@host" connection identifier
      to get the socket directory name. What a pain.
      
      [originally from svn r10222]
      24cd95b6
    • Simon Tatham's avatar
      New option to manually configure the expected host key(s). · 70ab076d
      Simon Tatham authored
      This option is available from the command line as '-hostkey', and is
      also configurable through the GUI. When enabled, it completely
      replaces all of the automated host key management: the server's host
      key will be checked against the manually configured list, and the
      connection will be allowed or disconnected on that basis, and the host
      key store in the registry will not be either consulted or updated.
      
      The main aim is to provide a means of automatically running Plink,
      PSCP or PSFTP deep inside Windows services where HKEY_CURRENT_USER
      isn't available to have stored the right host key in. But it also
      permits you to specify a list of multiple host keys, which means a
      second use case for the same mechanism will probably be round-robin
      DNS names that select one of several servers with different host keys.
      
      Host keys can be specified as the standard MD5 fingerprint or as an
      SSH-2 base64 blob, and are canonicalised on input. (The base64 blob is
      more unwieldy, especially with Windows command-line length limits, but
      provides a means of specifying the _whole_ public key in case you
      don't trust MD5. I haven't bothered to provide an analogous mechanism
      for SSH-1, on the basis that anyone worrying about MD5 should have
      stopped using SSH-1 already!)
      
      [originally from svn r10220]
      70ab076d
    • Simon Tatham's avatar
      Add an option to suppress horizontal scroll bars in list boxes. · f3860ec9
      Simon Tatham authored
      I'm about to add a list box which expects to contain some very long
      but uninformative strings, and which is also quite vertically squashed
      so there's not much room for a horizontal scroll bar to appear in it.
      So here's an option in the list box specification structure which
      causes the constructed GTKTreeView to use the 'ellipsize' option for
      all its cell renderers, i.e. too-long strings are truncated with an
      ellipsis.
      
      Windows needs no change, because its list boxes already work this way.
      
      [originally from svn r10219]
      f3860ec9
    • Simon Tatham's avatar
      Move base64_decode_atom into misc.c. · 80a9a791
      Simon Tatham authored
      I'm about to need to refer to it from a source file that won't
      necessarily always be linked against sshpubk.c, so it needs to live
      somewhere less specialist. Now it sits alongside base64_encode_atom
      (already in misc.c for another reason), which is neater anyway.
      
      [originally from svn r10218]
      80a9a791
    • Simon Tatham's avatar
      Handle save/load of set-typed config items. · 2e364812
      Simon Tatham authored
      I'm about to introduce a configuration option which is really a _set_
      of string values (rather than an ordered list), and I'm going to
      represent it in Conf as a string->string map (since that's a data type
      we already support) in which every key which exists at all maps to the
      empty string.
      
      This change modifies settings.c so that it can write out such options
      into the saved session as a comma-separated list of the key strings
      only, rather than the form 'string1=,string2=,string3=' which you'd
      get if you just used the existing wmap().
      
      (Reading the result back in turns out not to need a code change - the
      existing code already does what we want if it's reading a list of
      key=value pairs and one of them doesn't have an = sign at all.)
      
      [originally from svn r10217]
      2e364812
  6. Sep 07, 2014
    • Simon Tatham's avatar
      Close the listening socket when a sharing upstream dies. · aa62bce0
      Simon Tatham authored
      Without this, doing 'Restart Session' on Windows in a session with
      sharing enabled but no actual sharing being done would crash, because
      the first incarnation of the session would become an upstream and
      establish a listening named pipe, which then wouldn't get cleaned up
      when the session closed, so the restarted session would try to connect
      to it, triggering a call to plug_accepting on a freed sharestate.
      
      [originally from svn r10216]
      aa62bce0
    • Simon Tatham's avatar
      Cope with REG_SZ data not having a trailing NUL. · 9fa5b985
      Simon Tatham authored
      A user points out that the person who writes a REG_SZ into the
      registry can choose whether or not to NUL-terminate it properly, and
      if they don't, RegQueryValueEx will retrieve it without the NUL. So if
      someone does that to PuTTY's saved session data, then PuTTY may
      retrieve nonsense strings.
      
      Arguably this is the fault of whoever tampered with the saved session
      data without doing it the same way we would have, but even so, there
      ought to be some handling at our end other than silently returning the
      wrong data, and putting the NUL back on seems more sensible than
      complaining loudly.
      
      [originally from svn r10215]
      9fa5b985
  7. Aug 28, 2014
    • Simon Tatham's avatar
      Fix null dereference in ldisc_configure. · 92fba02d
      Simon Tatham authored
      The IDM_RECONF handler unconditionally calls ldisc_configure to
      reconfigure the line discipline for the new echo/edit settings, but in
      fact ldisc can be NULL if no session is currently active. (Indeed, the
      very next line acknowledges this, by testing it for NULL before
      calling ldisc_send!) Thanks to Alexander Wong for the report.
      
      [originally from svn r10214]
      92fba02d
  8. Jul 28, 2014
    • Simon Tatham's avatar
      Fix another crash at KEXINIT time, ahem. · 4b2a2060
      Simon Tatham authored
      This is the same code I previously fixed for failing to check NULL
      pointers coming back from ssh_pkt_getstring if the server's KEXINIT
      ended early, leading to an embarrassing segfault in place of a fatal
      error message. But I've now also had it pointed out to me that the
      fatal error message passes the string as %s, which is inappropriate
      because (being read straight out of the middle of an SSH packet) it
      isn't necessarily zero-terminated!
      
      This is still just an embarrassing segfault in place of a fatal error
      message, and not exploitable as far as I can see, because the string
      is passed to a dupprintf, which will either read off the end of
      allocated address space and segfault non-exploitably, or else it will
      find a NUL after all and carefully allocate enough space to format an
      error message containing all of the previous junk. But still, how
      embarrassing to have messed up the same code _twice_.
      
      [originally from svn r10211]
      4b2a2060
  9. Jul 24, 2014
    • Simon Tatham's avatar
      Truncate all terminal lines when we clear scrollback. · 44096228
      Simon Tatham authored
      Now Jacob has reminded me that 'resize-no-truncate' was already on the
      wishlist, I notice that it suggested Clear Scrollback should remove
      the preserved information off to the right. On the basis that that's
      (at least partly) a privacy feature, that seems sensible, so let's do it.
      
      [originally from svn r10210]
      44096228
  10. Jul 23, 2014
    • Simon Tatham's avatar
      Preserve truncated parts of terminal lines after a resize. · 271de3e4
      Simon Tatham authored
      We now only truncate a termline to the current terminal width if we're
      actually going to modify it. As a result, resizing to a narrower
      terminal width and then immediately back again, with no terminal
      output in between, should restore the previous screen contents. Only
      lines that are actually modified while the terminal is narrow (and
      scrolling them around doesn't count as modification) should now be
      truncated.
      
      This will be a bit nicer for Unix window resizing (since X lacks the
      Windows distinction between mid-drag resize events and the ultimate
      drag-release, so can't defer the call to term_size until the latter as
      we can on Windows), but mostly it's inspired by having played with a
      tiling window manager recently and hence realised that in some
      environments windows will be resized back and forth without much
      control as a side effect of just moving them around - so it's
      generally desirable for resizes to be non-destructive.
      
      [originally from svn r10208]
      271de3e4
  11. Jul 13, 2014
    • Simon Tatham's avatar
      Another fix to timer handling. · bc8de8a3
      Simon Tatham authored
      Robert de Bath points out that failure to remove the timer whose
      callback returned FALSE may not have been the cause of runaway timer
      explosion; another possibility is that a function called from
      timer_trigger()'s call to run_timers() has already set a timer up by
      the time run_timers() returns, and then we set another one up on top
      of it. Fix that too.
      
      [originally from svn r10206]
      bc8de8a3
  12. Jul 09, 2014
    • Simon Tatham's avatar
      Work around a timer leak with GTK 2.4.22 on openSUSE 13.1. · 4647eded
      Simon Tatham authored
      Mihkel Ader reports that on that system, timers apparently aren't
      getting auto-destroyed when timer_trigger returns FALSE, so the change
      in r10181 has caused GTK PuTTY to gradually allocate more and more
      timers and consume more and more CPU as they all keep firing.
      
      As far as I can see, this must surely be a bug in GTK 2 (the docs say
      that timers _are_ auto-destroyed when their callback returns false),
      and it doesn't seem to happen for me with GTK 2.4.23 on Ubuntu 14.04.
      However, I'll try to work around it by _explicitly_ destroying each
      old timer before we zero out the variable containing its id.
      
      [originally from svn r10202]
      [r10181 == e4c4bd20]
      4647eded
  13. Jul 07, 2014
    • Simon Tatham's avatar
      Fix automatic version numbering in the Unix tarball. · 7f17b44b
      Simon Tatham authored
      Manfred Schwarb points out that when I moved the autoconf machinery up
      from the unix subdirectory to the top level, in r10141, I missed a
      couple of lingering $(srcdir)/.. in the make rule for version.o, as a
      result of which the automatic checking of the manifest wasn't doing
      its thing and tools built from a standard .tar.gz were reporting as
      'Unidentified build'.
      
      [originally from svn r10201]
      [r10141 == a947c49b]
      7f17b44b
  14. Jul 06, 2014
    • Simon Tatham's avatar
      Implement this year's consensus on CHANNEL_FAILURE vs CHANNEL_CLOSE. · aaaf70a0
      Simon Tatham authored
      We now expect that after the server has sent us CHANNEL_CLOSE, we
      should not expect to see any replies to our outstanding channel
      requests, and conversely after we have sent CHANNEL_CLOSE we avoid
      sending any reply to channel requests from the server. This was the
      consensus among implementors discussing the problem on ietf-ssh in
      April 2014.
      
      To cope with current OpenSSH's (and perhaps other servers we don't
      know about yet) willingness to send request replies after
      CHANNEL_CLOSE, I introduce a bug-compatibility flag which is detected
      for every OpenSSH version up to and including the current 6.6 - but
      not beyond, since https://bugzilla.mindrot.org/show_bug.cgi?id=1818
      promises that 6.7 will also implement the new consensus behaviour.
      
      [originally from svn r10200]
      aaaf70a0
  15. May 26, 2014
  16. May 13, 2014
    • Simon Tatham's avatar
      Explicitly set the owning SID in make_private_security_descriptor. · 323b0d3f
      Simon Tatham authored
      Philippe Maupertuis reports that on one particular machine, Windows
      causes the named pipe created by upstream PuTTY to be owned by the
      Administrators group SID rather than the user's SID, which defeats the
      security check in the downstream PuTTY. No other machine has been
      reported to do this, but nonetheless it's clearly a thing that can
      sometimes happen, so we now work around it by specifying explicitly in
      the security descriptor for the pipe that its owner should be the user
      SID rather than any other SID we might have the right to use.
      
      [originally from svn r10188]
      323b0d3f
  17. Apr 23, 2014
  18. Apr 22, 2014
    • Simon Tatham's avatar
      Fix the prototype of the stub function in noshare.c. · 01d359f4
      Simon Tatham authored
      It's an old prototype from part way through the development of
      connection sharing, which I must have forgotten to fix because by the
      time I changed the prototype no platform was using noshare.c any more.
      
      [originally from svn r10183]
      01d359f4
  19. Apr 20, 2014
    • Simon Tatham's avatar
      Fix an annoying warning from GTK on Ubuntu 14.04. · e4c4bd20
      Simon Tatham authored
      Timer objects evaporate when our timer_trigger callback is called, and
      therefore we should not remember their ids beyond that time and
      attempt to cancel them later. Previous versions of GTK silently
      ignored us doing that, but upgrading to Ubuntu Trusty has given me a
      version of GTK that complains about it, so let's stop doing it.
      
      [originally from svn r10181]
      e4c4bd20
  20. Apr 18, 2014
  21. Mar 27, 2014
    • Simon Tatham's avatar
      Add auto-recognition of BUG_SSH2_RSA_PADDING for ProFTPD. · a44530bd
      Simon Tatham authored
      Martin Prikryl reports that it had the exact same bug as old OpenSSH
      (insisting that RSA signature integers be padded with leading zero
      bytes to the same length as the RSA modulus, where in fact RFC 4253
      section 6.6 says it ought to have _no_ padding), but is recently
      fixed. The first version string to not have the bug is reported to be
      "mod_sftp/0.9.9", so here we recognise everything less than that as
      requiring our existing workaround.
      
      [originally from svn r10161]
      a44530bd
  22. Mar 05, 2014
  23. Mar 04, 2014
  24. Feb 25, 2014
    • Simon Tatham's avatar
      Add a missing bn_restore_invariant in RSA blinding code. · b8e5f74d
      Simon Tatham authored
      We were inventing a random number by starting with a long zero bignum
      and then setting bits at random, which left an opportunity for the
      result to be a non-normalised representation (with a leading zero
      word) and hence fail an assertion in bignum_cmp.
      
      [originally from svn r10147]
      b8e5f74d
  25. Feb 22, 2014
    • Simon Tatham's avatar
      Add some assertions in sshzlib.c. · e2a5c6b6
      Simon Tatham authored
      gcc 4.8 compiling with -O3 gives a new warning about the access to
      st->pending at the top of lz77_compress, because for some reason it
      thinks there's an out-of-bounds array access there (or perhaps just a
      potential one, I'm not really sure which side -Warray-bounds is erring
      on). Add an assertion reassuring it that st->npending can't get bigger
      than the size of st->pending at the site it's complaining about, and a
      second one at the site where st->npending is increased (just in case
      my analysis of why it can't happen was wrong!). Also add a comment
      explaining the assertions.
      
      [originally from svn r10144]
      e2a5c6b6
    • Simon Tatham's avatar
      Add the autogenerated empty.h to CLEANFILES. · 3e71e3f9
      Simon Tatham authored
      Colin Watson points out that it's untidy to create it with the
      makefile but not clean it up again in the same way.
      
      [originally from svn r10143]
      3e71e3f9
Loading