Skip to content

Commit 8acc73f

Browse files
committed
bugfix: stream-typed cosocket might read uninitialized memory bytes when logging errors due to sending to or receiving from a closed socket.
1 parent 766ab66 commit 8acc73f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ngx_http_lua_socket_tcp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,9 +1258,9 @@ ngx_http_lua_socket_tcp_receive(lua_State *L)
12581258
if (llcf->log_socket_errors) {
12591259
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
12601260
"attempt to receive data on a closed socket: u:%p, "
1261-
"c:%p, ft:%ui eof:%ud",
1262-
u, u ? u->peer.connection : NULL, u ? u->ft_type : 0,
1263-
u ? u->eof : 0);
1261+
"c:%p, ft:%d eof:%d",
1262+
u, u ? u->peer.connection : NULL,
1263+
u ? (int) u->ft_type : 0, u ? (int) u->eof : 0);
12641264
}
12651265

12661266
lua_pushnil(L);
@@ -1886,9 +1886,9 @@ ngx_http_lua_socket_tcp_send(lua_State *L)
18861886
if (llcf->log_socket_errors) {
18871887
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
18881888
"attempt to send data on a closed socket: u:%p, "
1889-
"c:%p, ft:%ui eof:%ud",
1890-
u, u ? u->peer.connection : NULL, u ? u->ft_type : 0,
1891-
u ? u->eof : 0);
1889+
"c:%p, ft:%d eof:%d",
1890+
u, u ? u->peer.connection : NULL,
1891+
u ? (int) u->ft_type : 0, u ? (int) u->eof : 0);
18921892
}
18931893

18941894
lua_pushnil(L);

0 commit comments

Comments
 (0)