Missing NULL check after calling ecpg_strdup

Evgeniy Gorbanev <gorbanyoves@basealt.ru>

From: Evgeniy Gorbanev <gorbanyoves@basealt.ru>
To: pgsql-hackers@lists.postgresql.org
Date: 2025-07-11T10:27:59Z
Lists: pgsql-hackers

Attachments

Hi!

In case of out_of_memory, the ecpg_strdup function may return NULL.
Checks should be added in src/interfaces/ecpg/ecpglib/execute.c.
Patch attached.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

--
Best regards,
Evgeniy  Gorbanev

Commits

  1. ecpg: Improve error detection around ecpg_strdup()

  2. ecpg: Fix NULL pointer dereference during connection lookup