mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
6593009b0e
This is for sanitising output that's going to be sent to a terminal, if you don't want it to be able to send arbitrary escape sequences and thereby (for example) move the cursor back up to existing text on the screen and overprint it confusingly. It works using the standard C library: we convert to a wide-character string and back, and then use wctype.h to spot control characters in the intermediate form. This means its idea of the conversion character set is locale-based rather than any of our own charset library's fixed settings - which is what you want if the aim is to protect your local terminal (which we assume the system locale represents accurately). This also means that the sanitiser strips things that will _act_ as control characters when sent to the local terminal, whether or not they were intended as control characters by a server that might have had a different character set in mind. Since the main aim is to protect the local terminal rather than to faithfully replicate the server's intention, I think that's the right criterion. It only strips control characters at the charset-independent layer, like backspace, carriage return and the escape character: wctype.h classifies those as control characters, but classifies as printing all of the more Unicode-specific controls like bidirectional overrides. But that's enough to prevent cursor repositioning, for example. stripctrl.c comes with a test main() of its own, which I wasn't able to fold into testcrypt and put in the test suite because of its dependence on the system locale - it wouldn't be guaranteed to work the same way on different test systems anyway. A knock-on build tweak: because you can feed data into this sanitiser in chunks of arbitrary size, including partial multibyte chars, I had to use mbrtowc() for the decoding, and that means that in the 'old' Win32 builds I have to link against the Visual Studio C++ library as well as the C library, because for some reason that's where mbrtowc lived in VS2003.
156 lines
1.8 KiB
Plaintext
156 lines
1.8 KiB
Plaintext
*.o
|
|
*.pyc
|
|
.dirstamp
|
|
.deps
|
|
.DS_Store
|
|
/*.pdb
|
|
/*.ilk
|
|
/*.res
|
|
/*.RES
|
|
/*.pch
|
|
/*.rsp
|
|
/*.obj
|
|
/*.exe
|
|
/*.ncb
|
|
/*.plg
|
|
/*.dsw
|
|
/*.opt
|
|
/*.dsp
|
|
/*.tds
|
|
/*.td2
|
|
/*.map
|
|
/Makefile.mgw
|
|
/Makefile.vc
|
|
/Makefile.lcc
|
|
/MSVC
|
|
/*.log
|
|
/*.GID
|
|
/local
|
|
/Output
|
|
/pageant
|
|
/plink
|
|
/pscp
|
|
/psftp
|
|
/putty
|
|
/puttytel
|
|
/puttygen
|
|
/pterm
|
|
/puttyapp
|
|
/ptermapp
|
|
/osxlaunch
|
|
/uppity
|
|
/unix/PuTTY.app
|
|
/unix/Pterm.app
|
|
/fuzzterm
|
|
/testcrypt
|
|
/testsc
|
|
/testzlib
|
|
/cgtest
|
|
/scctest
|
|
/*.DSA
|
|
/*.RSA
|
|
/*.cnt
|
|
/*.hlp
|
|
/.bmake
|
|
/build.log
|
|
/build.out
|
|
/uxconfig.h
|
|
/empty.h
|
|
/config.status
|
|
/Makefile.am
|
|
/Makefile.in
|
|
/Makefile
|
|
/compile
|
|
/config.status
|
|
/configure
|
|
/stamp-h1
|
|
/aclocal.m4
|
|
/ar-lib
|
|
/autom4te.cache
|
|
/depcomp
|
|
/install-sh
|
|
/local
|
|
/missing
|
|
/uxconfig.in
|
|
/uxconfig.in~
|
|
/uxconfig.h
|
|
/licence.h
|
|
/*.a
|
|
/charset/sbcsdat.c
|
|
/contrib/cygtermd/cygtermd.exe
|
|
/doc/*.html
|
|
/doc/*.txt
|
|
/doc/*.cnt
|
|
/doc/*.hlp
|
|
/doc/*.gid
|
|
/doc/*.GID
|
|
/doc/*.chm
|
|
/doc/*.log
|
|
/doc/*.1
|
|
/doc/*.info
|
|
/doc/vstr.but
|
|
/doc/*.hhp
|
|
/doc/*.hhc
|
|
/doc/*.hhk
|
|
/doc/licence.but
|
|
/doc/copy.but
|
|
/icons/*.pam
|
|
/icons/*.png
|
|
/icons/*.ico
|
|
/icons/*.icns
|
|
/icons/*.xpm
|
|
/icons/*.c
|
|
/unix/Makefile.gtk
|
|
/unix/Makefile.ux
|
|
/unix/Makefile.local
|
|
/unix/empty.h
|
|
/unix/plink
|
|
/unix/pterm
|
|
/unix/putty
|
|
/unix/puttytel
|
|
/unix/psftp
|
|
/unix/pscp
|
|
/unix/puttygen
|
|
/unix/stamp-h1
|
|
/unix/*.log
|
|
/unix/.deps
|
|
/windows/*.pdb
|
|
/windows/*.ilk
|
|
/windows/*.res
|
|
/windows/*.RES
|
|
/windows/*.pch
|
|
/windows/*.rsp
|
|
/windows/*.obj
|
|
/windows/*.exe
|
|
/windows/*.ncb
|
|
/windows/*.plg
|
|
/windows/*.dsw
|
|
/windows/*.opt
|
|
/windows/*.dsp
|
|
/windows/*.tds
|
|
/windows/*.td2
|
|
/windows/*.map
|
|
/windows/*.rcpp
|
|
/windows/Makefile.clangcl
|
|
/windows/Makefile.mgw
|
|
/windows/Makefile.vc
|
|
/windows/Makefile.lcc
|
|
/windows/MSVC
|
|
/windows/DEVCPP
|
|
/windows/VS2010
|
|
/windows/VS2012
|
|
/windows/*.log
|
|
/windows/*.GID
|
|
/windows/local
|
|
/windows/Output
|
|
/windows/*.DSA
|
|
/windows/*.RSA
|
|
/windows/*.cnt
|
|
/windows/*.hlp
|
|
/windows/.bmake
|
|
/windows/*.sln
|
|
/windows/*.suo
|
|
/windows/*.msi
|
|
/windows/*.wixobj
|
|
/windows/*.wixpdb
|