diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-02-10 19:30:11 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-02-10 19:30:11 -0500 |
commit | b10635bb5b2e5f4e7e4a5e5a3313dcd70cf0509c (patch) | |
tree | 9d3aa1e573146485233ad43dbbe99c4a81cd4cb9 /src/backend/access/gist/gistxlog.c | |
parent | 616eaa396a9bf82d8208a79367d784590be9370d (diff) | |
download | postgresql-b10635bb5b2e5f4e7e4a5e5a3313dcd70cf0509c.tar.gz postgresql-b10635bb5b2e5f4e7e4a5e5a3313dcd70cf0509c.zip |
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.
Diffstat (limited to 'src/backend/access/gist/gistxlog.c')
0 files changed, 0 insertions, 0 deletions