Returning non-terminated string in ECPG Informix-compatible function
Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
From: o.tselebrovskiy@postgrespro.ru
To: pgsql-hackers@postgresql.org
Date: 2024-01-29T08:47:31Z
Lists: pgsql-hackers
Attachments
- informix_null_terminator.patch (text/x-diff) patch
Greetings, everyone! While analyzing output of Svace static analyzer [1] I've found a bug. In function intoasc(interval * i, char *str) from file src/interfaces/ecpg/compatlib/informix.c we return a non-terminated string since we use memcpy on tmp which is itself NULL-teminated but last zero byte is not copied. The proposed solution is to use strcpy instead, since it is used in all other functions in informix.c. The patch is attached. [1] - https://svace.pages.ispras.ru/svace-website/en/ Oleg Tselebrovskiy, Postgres Pro
Commits
-
ecpg: Fix zero-termination of string generated by intoasc()
- 771240f972ee 12.19 landed
- c031ce97b561 13.15 landed
- a05bb9addb37 14.12 landed
- b5cb6022bbf0 15.7 landed
- 88e03d055d18 16.3 landed
- e77a1c58e338 17.0 landed
-
ecpg: Fix error handling on OOMs when parsing timestamps
- 0a9118ccc0eb 17.0 landed