]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Clear errno before calling strtol() in spell.c.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Mar 2025 16:24:22 +0000 (11:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 8 Mar 2025 16:24:47 +0000 (11:24 -0500)
commit61513da08b169fcc58c78bdf8752a81ea1fc92bd
tree6eba104df47f01e5f1667a15c2a284740804d678
parent98aa99b6d68293b500ad3a1042dfa22dd2e96918
Clear errno before calling strtol() in spell.c.

Per POSIX, a caller of strtol() that wishes to check for errors must
set errno to 0 beforehand.  Several places in spell.c neglected that,
so that they risked delivering a false overflow error in case errno
had been ERANGE already.  Given the lack of field reports, this case
may be unreachable at present --- but it's surely trouble waiting to
happen, so fix it.

Author: Jacob Brazeal <jacob.brazeal@gmail.com>
Discussion: https://postgr.es/m/CA+COZaBhsq6EromFm+knMJfzK6nTpG23zJ+K2=nfUQQXcj_xcQ@mail.gmail.com
Backpatch-through: 13
src/backend/tsearch/spell.c