pgsql: Clear errno before calling strtol() in spell.c. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Clear errno before calling strtol() in spell.c.
Date
Msg-id E1tqwzE-001Rv1-1u@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/61513da08b169fcc58c78bdf8752a81ea1fc92bd

Modified Files
--------------
src/backend/tsearch/spell.c | 4 ++++
1 file changed, 4 insertions(+)


pgsql-committers by date:

Previous
From: Peter Geoghegan
Date:
Subject: pgsql: Make parallel nbtree index scans use an LWLock.
Next
From: Jeff Davis
Date:
Subject: pgsql: Don't convert to and from floats in pg_dump.