pgsql: Use safe string copy routine

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use safe string copy routine
Date: 2024-07-02 09:25:59
Message-ID: E1sOZlu-00017D-FL@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use safe string copy routine

Using memcpy with strlen as the size parameter will not take the
NULL terminator into account, relying instead on the destination
buffer being properly initialized. Replace with strlcpy which is
a safer alternative, and more in line with how we handle copying
strings elsewhere.

Author: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAEudQApAsbLsQ+gGiw-hT+JwGhgogFa_=5NUkgFO6kOPxyNidQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e930c872b65c19c8950556fa94aa9ab53b2919b0

Modified Files
--------------
src/backend/access/transam/xlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2024-07-02 16:24:12 pgsql: pg_dump: Remove some unused return values.
Previous Message Peter Eisentraut 2024-07-02 08:44:44 pgsql: Remove too demanding test