From 47283b7c76248b4d29a13c4e465fea0516403c8f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 5 Jul 2024 11:40:34 +0200 Subject: [PATCH] deamon-helper: ensure helper_complete() never returns NULL on success The in_buffer is initialized with a NULL buffer. If we never receive and data, the buffer might still be NULL. Maybe it actually can never happen, but it's not clear that this is always the case. To be sure, ensure we don't return a NULL buffer on success. --- src/core/nm-core-utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index dd1e9939d9..6aa38be288 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -5096,7 +5096,9 @@ helper_complete(HelperInfo *info, GError *error) } nm_clear_g_cancellable_disconnect(g_task_get_cancellable(info->task), &info->cancellable_id); - g_task_return_pointer(info->task, nm_str_buf_finalize(&info->in_buffer, NULL), g_free); + g_task_return_pointer(info->task, + nm_str_buf_finalize(&info->in_buffer, NULL) ?: g_new0(char, 1), + g_free); helper_info_free(info); }