diff mbox series

[09/12] IPC: check if variable is set in SET_SWUPDATE_VARS

Message ID 20231016165740.1374614-9-stefano.babic@swupdate.org
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series [01/12] Cleanup: use #pragma once in all headers | expand

Commit Message

Stefano Babic Oct. 16, 2023, 4:57 p.m. UTC
Check if the passed string is empty instead of check the buffer, that is
always valid. In last case, an empty string is passed and the variable
is set to "" instead to be removed.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 core/network_thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/core/network_thread.c b/core/network_thread.c
index 6b349784..49e165df 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -694,7 +694,7 @@  void *network_thread (void *data)
 				break;
 			case SET_SWUPDATE_VARS:
 				msg.type = swupdate_vars_set(msg.data.vars.varname,
-						  msg.data.vars.varvalue,
+						  strlen(msg.data.vars.varvalue) ? msg.data.vars.varvalue : NULL,
 						  msg.data.vars.varnamespace) == 0 ? ACK : NACK;
 				break;
 			case GET_SWUPDATE_VARS: