diff mbox series

[1/3] BUG: hawkbit: check if details are sent via IPC

Message ID 20240415101906.45782-1-stefano.babic@swupdate.org
State Accepted
Delegated to: Stefano Babic
Headers show
Series [1/3] BUG: hawkbit: check if details are sent via IPC | expand

Commit Message

Stefano Babic April 15, 2024, 10:19 a.m. UTC
SWUpdate stops after assert() fails if details are missing.

All fields are mandatory, so check that even details are sent. If not
required, a dummy string should be sent.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 suricatta/server_hawkbit.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.34.1
diff mbox series

Patch

diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c
index 7ceb1dc0..f1948c68 100644
--- a/suricatta/server_hawkbit.c
+++ b/suricatta/server_hawkbit.c
@@ -2054,6 +2054,10 @@  static server_op_res_t server_activation_ipc(ipc_message *msg)
 		return  SERVER_EERR;
 	}

+	if (!json_data) {
+		ERROR("No details are passed, they are mandatory.");
+		return SERVER_EERR;
+	}
 	int numdetails = json_object_array_length(json_data);
 	const char **details = (const char **)malloc((numdetails + 1) * (sizeof (char *)));
 	if(!details)