Re: Missing NULL check after calling ecpg_strdup
Aleksander Alekseev <aleksander@tigerdata.com>
From: Aleksander Alekseev <aleksander@tigerdata.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org, Evgeniy Gorbanev <gorbanyoves@basealt.ru>
Date: 2025-07-18T13:45:44Z
Lists: pgsql-hackers
Attachments
- v5-0001-Add-proper-checks-for-ecpg_strdup-return-value.patch (text/x-patch) patch v5-0001
- v5-0002-Add-alloc_failed-argument-to-ecpg_strdup.patch (text/x-patch) patch v5-0002
Hi Michael, Thanks for all your great feedback. > Or you could keep the "lineno" and the error generated in memory.c as > this gives enough details about the location where the problem > happens. We are going to need the extra "alloc_failed". > > [...] > > Hmm. But both are related and the same problem, no? This is touching > the same code paths.. > > [...] > > Nope, we could keep this shortcut in ecpg_strdup() as long as there is > an extra field to track if an error has happened. OK, patch 0002 implements this idea with minimal changes to the existing logic.
Commits
-
ecpg: Improve error detection around ecpg_strdup()
- a6eabec6808c 19 (unreleased) landed
-
ecpg: Fix NULL pointer dereference during connection lookup
- c934d5673894 13.22 landed
- 408fe659a890 14.19 landed
- 0123922f82d2 15.14 landed
- 313d3102facd 16.10 landed
- 2805e1c1edd5 17.6 landed
- 0ded7615d8ca 18.0 landed
- 1b8bbee05d70 19 (unreleased) landed