spice-vdagent/vdagentd-Better-check-for-vdagent_connection_get_pee.patch
Bruce Rogers 6ff184c434 Accepting request 846096 from home:bfrogers:branches:Virtualization
- Fix multiple security issues as outlined in bsc#1173749
  bsc#1177780 bsc#1177781 bsc#1177782 bsc#1177783
  CVE-2020-25650 CVE-2020-25651 CVE-2020-25652 CVE-2020-25653
  systemd-login-Avoid-a-crash-on-container.patch
  vdagentd-Use-bool-for-agent_owns_clipboard-and-clien.patch
  vdagentd-Automatically-release-agent_data.patch
  vdagent-connection-Pass-err-to-g_credentials_get_uni.patch
  vdagentd-Better-check-for-vdagent_connection_get_pee.patch
  vdagentd-Avoid-calling-chmod.patch
  Avoids-unchecked-file-transfer-IDs-allocation-and-us.patch
  Avoids-uncontrolled-active_xfers-allocations.patch
  Avoids-unlimited-agent-connections.patch
  Avoids-user-session-hijacking.patch
  Better-check-for-sessions.patch
  vdagentd-Limit-number-of-agents-per-session-to-1.patch
  cleanup-active_xfers-when-the-client-disconnects.patch
  vdagentd-do-not-allow-to-use-an-already-used-file-xf.patch
  Add-a-test-for-session_info.patch
- Add a check section to run internal tests. Note that by default
  the added session_info test is not run, as it doesn't work in
  context of build service

OBS-URL: https://build.opensuse.org/request/show/846096
OBS-URL: https://build.opensuse.org/package/show/Virtualization/spice-vdagent?expand=0&rev=41
2020-11-05 00:50:56 +00:00

49 lines
1.7 KiB
Diff

From 7e924bcbf0bb6b300c6518499c05e87cea13ac51 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <freddy77@gmail.com>
Date: Mon, 21 Sep 2020 16:42:26 +0100
Subject: [PATCH] vdagentd: Better check for vdagent_connection_get_peer_pid
results
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 7e924bcbf0bb6b300c6518499c05e87cea13ac51
References: bsc#1173749
The function can return -1 and leave "err" to NULL in some cases,
do not check only for "err".
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Julien Ropé <jrope@redhat.com>
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
src/vdagentd/vdagentd.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
index cd6340e..560f2ce 100644
--- a/src/vdagentd/vdagentd.c
+++ b/src/vdagentd/vdagentd.c
@@ -933,10 +933,14 @@ static void agent_connect(UdscsConnection *conn)
if (session_info) {
pid = vdagent_connection_get_peer_pid(VDAGENT_CONNECTION(conn), &err);
- if (err) {
- syslog(LOG_ERR, "Could not get peer PID, disconnecting new client: %s",
- err->message);
- g_error_free(err);
+ if (err || pid <= 0) {
+ static const char msg[] = "Could not get peer PID, disconnecting new client";
+ if (err) {
+ syslog(LOG_ERR, "%s: %s", msg, err->message);
+ g_error_free(err);
+ } else {
+ syslog(LOG_ERR, "%s", msg);
+ }
agent_data_destroy(agent_data);
udscs_server_destroy_connection(server, conn);
return;
--
2.29.0