pgsql: Fix two memcpy() bugs in the new injection point code

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix two memcpy() bugs in the new injection point code
Date: 2024-01-22 19:01:56
Message-ID: E1rRzYS-002cid-Mf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix two memcpy() bugs in the new injection point code

1. The memcpy()s in InjectionPointAttach() would copy garbage from
beyond the end of input string to the buffer in shared memory. You
won't usually notice, but if there is not enough valid mapped memory
beyond the end of the string, the read of unmapped memory will
segfault. This was flagged by the Cirrus CI build with address
sanitizer enabled.

2. The memcpy() in injection_point_cache_add() failed to copy the NULL
terminator.

Discussion: https://www.postgresql.org/message-id/0615a424-b726-4157-afa7-4245629f9512%40iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0eb23285a2579591c09a591e5a52829f65665341

Modified Files
--------------
src/backend/utils/misc/injection_point.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-01-23 01:49:52 pgsql: Fix ERROR message in injection_point.c
Previous Message Alvaro Herrera 2024-01-22 16:50:37 pgsql: Abort pgbench if script end is reached with an open pipeline