postgresql/src
Tom Lane 51e78ab4ff Avoid use of sscanf() to parse ispell dictionary files.
It turns out that on FreeBSD-derived platforms (including OS X), the
*scanf() family of functions is pretty much brain-dead about multibyte
characters.  In particular it will apply isspace() to individual bytes
of input even when those bytes are part of a multibyte character, thus
allowing false recognition of a field-terminating space.

We appear to have little alternative other than instituting a coding
rule that *scanf() is not to be used if the input string might contain
multibyte characters.  (There was some discussion of relying on "%ls",
but that probably just moves the portability problem somewhere else,
and besides it doesn't fully prevent BSD *scanf() from using isspace().)

This patch is a down payment on that: it gets rid of use of sscanf()
to parse ispell dictionary files, which are certainly at great risk
of having a problem.  The code is cleaner this way anyway, though
a bit longer.

In passing, improve a few comments.

Report and patch by Artur Zakirov, reviewed and somewhat tweaked by me.
Back-patch to all supported branches.
2016-02-10 19:30:11 -05:00
..
backend Avoid use of sscanf() to parse ispell dictionary files. 2016-02-10 19:30:11 -05:00
bin Revert "Temporarily make pg_ctl and server shutdown a whole lot chattier." 2016-02-10 16:01:04 -05:00
common Fix typos in comments 2016-02-01 11:43:48 +01:00
include Revert "Temporarily make pg_ctl and server shutdown a whole lot chattier." 2016-02-10 16:01:04 -05:00
interfaces Make sure ecpg header files do not have a comment lasting several lines, one of 2016-02-01 13:21:00 +01:00
makefiles Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
pl Remove no-longer-needed old-style check for incompatible plpythons. 2016-01-11 20:13:31 -05:00
port Fix order of arguments to va_start() 2016-01-07 20:32:49 -03:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Fix some regex issues with out-of-range characters and large char ranges. 2016-02-08 10:25:40 -05:00
timezone Update time zone data files to tzdata release 2016a. 2016-02-05 10:59:09 -05:00
tools Change the way that LWLocks for extensions are allocated. 2016-02-04 16:43:04 -05:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Add support for systemd service notifications 2016-02-02 21:04:29 -05:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00