mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 00:02:26 -04:00
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
This commit is contained in:
parent
a06e8f84a1
commit
f3412a61f3
@ -762,7 +762,8 @@ save_backend_variables(BackendParameters *param, ClientSocket *client_sock,
|
||||
strlcpy(param->pkglib_path, pkglib_path, MAXPGPATH);
|
||||
|
||||
param->startup_data_len = startup_data_len;
|
||||
memcpy(param->startup_data, startup_data, startup_data_len);
|
||||
if (startup_data_len > 0)
|
||||
memcpy(param->startup_data, startup_data, startup_data_len);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user