gupnp/service-action-Protect-against-unsent-message-use.patch
fandehui 2890d6210f service-action: Protect against unsent message use
If the action wasn't sent, do not crash
2023-10-27 20:55:49 +08:00

34 lines
1.1 KiB
Diff

From 8a349541f10b774ac8128bfb0e25ddbb405e6033 Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Wed, 19 May 2021 19:40:41 +0200
Subject: [PATCH] service-action: Protect against unsent message use
If the action wasn't sent, do not crash
---
libgupnp/gupnp-service-proxy-action.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libgupnp/gupnp-service-proxy-action.c b/libgupnp/gupnp-service-proxy-action.c
index 3b3a7c1..2fd10d5 100644
--- a/libgupnp/gupnp-service-proxy-action.c
+++ b/libgupnp/gupnp-service-proxy-action.c
@@ -61,6 +61,15 @@ check_action_response (G_GNUC_UNUSED GUPnPServiceProxy *proxy,
xmlDoc *response;
int code;
+ if (action->msg == NULL) {
+ g_set_error (error,
+ GUPNP_SERVER_ERROR,
+ GUPNP_SERVER_ERROR_INVALID_RESPONSE,
+ "No message, the action was not sent?");
+
+ return NULL;
+ }
+
/* Check for errors */
switch (action->msg->status_code) {
case SOUP_STATUS_OK:
--
2.27.0