Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SIGSEGV in the "CONFIG" command over syslog-ng-ctl #3900

Merged
merged 3 commits into from Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/control/tests/test_control_cmds.c
Expand Up @@ -117,7 +117,7 @@ Test(control_cmds, test_log)
const gchar *response;

_run_command("LOG", &response);
cr_assert(first_line_eq(response, "Invalid arguments received, expected at least one argument"),
cr_assert(first_line_eq(response, "FAIL Invalid arguments received"),
"Bad reply: [%s]", response);

_run_command("LOG fakelog", &response);
Expand Down
8 changes: 7 additions & 1 deletion lib/mainloop-control.c
Expand Up @@ -44,7 +44,7 @@ control_connection_message_log(ControlConnection *cc, GString *command, gpointer

if (!cmds[1])
{
g_string_assign(result, "Invalid arguments received, expected at least one argument");
g_string_assign(result, "FAIL Invalid arguments received");
goto exit;
}

Expand Down Expand Up @@ -94,6 +94,12 @@ control_connection_config(ControlConnection *cc, GString *command, gpointer user
GString *result = g_string_sized_new(128);
gchar **arguments = g_strsplit(command->str, " ", 0);

if (!arguments[1])
{
g_string_assign(result, "FAIL Invalid arguments");
goto exit;
}

if (g_str_equal(arguments[1], "GET"))
{
if (g_str_equal(arguments[2], "ORIGINAL"))
Expand Down
5 changes: 5 additions & 0 deletions news/bugfix-3900.md
@@ -0,0 +1,5 @@
`syslog-ng`: fix a SIGSEGV triggered by an incorrectly formatted "CONFIG"
command, received on the syslog-ng control socket. The only known
implementation of the control protocol is syslog-ng-ctl itself, which always
sends a correct command, but anyone with access to the UNIX domain socket
`syslog-ng.ctl` (root only by default) can trigger a crash.