diff mbox series

[V2,06/11] IPC: check if variable is set in SET_SWUPDATE_VARS

Message ID 20231017140657.95860-7-stefano.babic@swupdate.org
State Accepted
Delegated to: Stefano Babic
Headers show
Series Handle Hawkbit action_id and on the fly updates | expand

Commit Message

Stefano Babic Oct. 17, 2023, 2:06 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: