]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Prevent some buffer overruns in spell.c's parsing of affix files.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 22 Apr 2026 16:02:15 +0000 (12:02 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 22 Apr 2026 16:02:15 +0000 (12:02 -0400)
commit42383d32d78acb13cc9a2245f037a73b39d4573b
treefefa8eb3ce883e85441e339ebe05a3f226ec8d4e
parent17f72e037f20354e3b4a4309dde02a7592075d4b
Prevent some buffer overruns in spell.c's parsing of affix files.

parse_affentry() and addCompoundAffixFlagValue() each collect fields
from an affix file into working buffers of size BUFSIZ.  They failed
to defend against overlength fields, so that a malicious affix file
could cause a stack smash.  BUFSIZ (typically 8K) is certainly way
longer than any reasonable affix field, but let's fix this while
we're closing holes in this area.

I chose to do this by silently truncating the input before it can
overrun the buffer, using logic comparable to the existing logic in
get_nextfield().  Certainly there's at least as good an argument for
raising an error, but for now let's follow the existing precedent.

Reported-by: Igor Stepansky <igor.stepansky@orca.security>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/864123.1776810909@sss.pgh.pa.us
Backpatch-through: 14
src/backend/tsearch/spell.c