Skip to content

Commit

Permalink
common: Initialize message in cockpit_web_request_on_socket_input()
Browse files Browse the repository at this point in the history
g_socket_receive_message() can fail, and a lot of exit paths don't
initialize `ccm.n_messages`.

Initialize the struct (like in test-jsonfds.c), so that
cockpit_control_messages_clear() does not try to free uninitialized
message pointers.

Fixes cockpit-project#17492
  • Loading branch information
martinpitt committed Aug 3, 2022
1 parent 9591ec2 commit 1376040
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/cockpitwebserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ cockpit_web_request_on_socket_input (GSocket *socket,
GError *error = NULL;
GIOStream *tls_stream;
gssize num_read;
g_auto(CockpitControlMessages) ccm;
g_auto(CockpitControlMessages) ccm = COCKPIT_CONTROL_MESSAGES_INIT;

num_read = g_socket_receive_message (socket,
NULL, /* out GSocketAddress */
Expand Down

0 comments on commit 1376040

Please sign in to comment.