From c4b39914c4ea7b17e1cbdfd7efd487b4d35abbb1 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 19 Dec 2025 17:24:20 +0100 Subject: [PATCH] core: limit the result from the helper to 32MiB --- src/core/nm-core-utils.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 2c2e282ff7..219964f0f6 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -5459,6 +5459,14 @@ helper_have_data(int fd, GIOCondition condition, gpointer user_data) n_read = nm_utils_fd_read(fd, &info->in_buffer); _LOG2T(info, "read returns %ld", (long) n_read); + if (info->in_buffer.len > 32 * 1024 * 1024) { + helper_complete(info, + g_error_new_literal(NM_UTILS_ERROR, + NM_UTILS_ERROR_UNKNOWN, + "the output is larger than 32MiB")); + return G_SOURCE_CONTINUE; + } + if (n_read > 0) return G_SOURCE_CONTINUE;