postgresql/contrib/dict_int
Tomas Vondra a2fdeb7863 Ensure maxlen is at leat 1 in dict_int
The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4
2019-12-03 18:42:54 +01:00
..
expected Ensure maxlen is at leat 1 in dict_int 2019-12-03 18:42:54 +01:00
sql Ensure maxlen is at leat 1 in dict_int 2019-12-03 18:42:54 +01:00
.gitignore
dict_int--1.0.sql Throw a useful error message if an extension script file is fed to psql. 2011-10-12 15:45:03 -04:00
dict_int--unpackaged--1.0.sql Fix typos in some error messages thrown by extension scripts when fed to psql. 2014-08-25 18:30:37 +02:00
dict_int.c Ensure maxlen is at leat 1 in dict_int 2019-12-03 18:42:54 +01:00
dict_int.control
Makefile Add file version information to most installed Windows binaries. 2014-07-14 14:07:52 -04:00