Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3412a6

Browse filesBrowse files
committed
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
1 parent a06e8f8 commit f3412a6
Copy full SHA for f3412a6

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed

‎src/backend/postmaster/launch_backend.c

Copy file name to clipboardExpand all lines: src/backend/postmaster/launch_backend.c
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,8 @@ save_backend_variables(BackendParameters *param, ClientSocket *client_sock,
762762
strlcpy(param->pkglib_path, pkglib_path, MAXPGPATH);
763763

764764
param->startup_data_len = startup_data_len;
765-
memcpy(param->startup_data, startup_data, startup_data_len);
765+
if (startup_data_len > 0)
766+
memcpy(param->startup_data, startup_data, startup_data_len);
766767

767768
return true;
768769
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.