Avoid 0-length memcpy to NULL with EXEC_BACKEND

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: f3412a61f3f92d795ce0c8bb715831ec02124bfb
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2024-07-03T12:58:14Z
Releases: 18.0
Avoid 0-length memcpy to NULL with EXEC_BACKEND

memcpy(NULL, src, 0) is forbidden by POSIX, even though every
production version of libc allows it. Let's be tidy.

Per report from Thomas Munro, running UBSan with EXEC_BACKEND.
Backpatch to v17, where this code was added.

Discussion: https://www.postgresql.org/message-id/CA%2BhUKG%2Be-dV7YWBzfBZXsgovgRuX5VmvmOT%2Bv0aXiZJ-EKbXcw@mail.gmail.com

Files

PathChange+/−
src/backend/postmaster/launch_backend.c modified +2 −1

Discussion