summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-29 16:26:05 +0100
committerThomas Haller <thaller@redhat.com>2017-11-29 16:26:28 +0100
commitde92e88161485dfb931112de2e4632082f54efe0 (patch)
tree91ee68064c61d8724f3b761930f6833b8987611a
parent21cfeff7776cfaf2b64edca0fdbc10bff93730a8 (diff)
downloadNetworkManager-de92e88161485dfb931112de2e4632082f54efe0.tar.gz
shared: fix nm_utils_strsplit_set() to increase buffer size exponentially
-rw-r--r--shared/nm-utils/nm-shared-utils.c2
1 files changed, 1 insertions, 1 deletions
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)