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 cb9663e

Browse filesBrowse files
committed
Fix copying SockAddr struct
Valgrind alerted about accessing uninitialized bytes after commit 4945e4e: ==700242== VALGRINDERROR-BEGIN ==700242== Conditional jump or move depends on uninitialised value(s) ==700242== at 0x6D8A2A: getnameinfo_unix (ip.c:253) ==700242== by 0x6D8BD1: pg_getnameinfo_all (ip.c:122) ==700242== by 0x4B3EB6: BackendInitialize (postmaster.c:4266) ==700242== by 0x4B684E: BackendStartup (postmaster.c:4114) ==700242== by 0x4B6986: ServerLoop (postmaster.c:1780) ==700242== by 0x4B80CA: PostmasterMain (postmaster.c:1478) ==700242== by 0x3F7424: main (main.c:197) ==700242== Uninitialised value was created by a stack allocation ==700242== at 0x4B6934: ServerLoop (postmaster.c:1737) ==700242== ==700242== VALGRINDERROR-END That was because the SockAddr struct was not copied correctly. Per buildfarm animal "skink".
1 parent 4945e4e commit cb9663e
Copy full SHA for cb9663e

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/libpq/pqcomm.c

Copy file name to clipboardExpand all lines: src/backend/libpq/pqcomm.c
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ pq_init(ClientSocket *client_sock)
177177
/* allocate the Port struct and copy the ClientSocket contents to it */
178178
port = palloc0(sizeof(Port));
179179
port->sock = client_sock->sock;
180-
port->raddr = client_sock->raddr;
180+
memcpy(&port->raddr.addr, &client_sock->raddr.addr, client_sock->raddr.salen);
181+
port->raddr.salen = client_sock->raddr.salen;
181182

182183
/* fill in the server (local) address */
183184
port->laddr.salen = sizeof(port->laddr.addr);

0 commit comments

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