From ef3cd489e1d974a6337a27de0d57326decc7f097 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 26 Feb 2015 02:28:52 +0100 Subject: [PATCH] libnm: fix clearing memory in file_to_secure_bytes() If we go through the lengths of clearing the allocated memory, we must not forget @contents. (cherry picked from commit 88a79625a667a562831925d4636bf819e0aa0f6b) --- libnm-core/nm-setting-8021x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnm-core/nm-setting-8021x.c b/libnm-core/nm-setting-8021x.c index 259eea7cfc..8b8950b222 100644 --- a/libnm-core/nm-setting-8021x.c +++ b/libnm-core/nm-setting-8021x.c @@ -1755,7 +1755,7 @@ file_to_secure_bytes (const char *filename) if (g_file_get_contents (filename, &contents, &length, NULL)) { array = g_byte_array_sized_new (length); g_byte_array_append (array, (guint8 *) contents, length); - g_assert (array->len == length); + memset (contents, 0, length); g_free (contents); return g_bytes_new_with_free_func (array->data, array->len, free_secure_bytes, array); }