From de92e88161485dfb931112de2e4632082f54efe0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 29 Nov 2017 16:26:05 +0100 Subject: [PATCH] shared: fix nm_utils_strsplit_set() to increase buffer size exponentially --- shared/nm-utils/nm-shared-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/nm-utils/nm-shared-utils.c b/shared/nm-utils/nm-shared-utils.c index 2e42dc0cac..0b343afdf8 100644 --- a/shared/nm-utils/nm-shared-utils.c +++ b/shared/nm-utils/nm-shared-utils.c @@ -569,7 +569,7 @@ nm_utils_strsplit_set (const char *str, const char *delimiters) /* reallocate the buffer. Note that for now the string * continues to be in ptr0/s0. We fix that at the end. */ - alloc_size += 2; + alloc_size *= 2; ptr = g_malloc ((sizeof (const char *) * (alloc_size + 1)) + str_len); memcpy (ptr, ptr_old, sizeof (const char *) * plen); if (ptr_old != ptr0)