[glib/wip/2-58-cve-2021-27219: 1/3] gvariant test: Use g_memdup2
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/2-58-cve-2021-27219: 1/3] gvariant test: Use g_memdup2
- Date: Fri, 19 Mar 2021 10:27:30 +0000 (UTC)
commit 1436fedbab6eca8c8836075bb213c001acca85b6
Author: Simon McVittie <smcv collabora com>
Date: Thu Mar 18 10:33:32 2021 +0000
gvariant test: Use g_memdup2
This code no longer existed on the glib-2-66 branch, but it's present
in glib-2-58. It's easier to verify that all potentially problematic
g_memdup() uses have been replaced if we replace these too.
Helps: #2319
Signed-off-by: Simon McVittie <smcv collabora com>
glib/tests/gvariant.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 18800f980..e6ac3241b 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <stdlib.h>
#include <glib.h>
+#include "gstrfuncsprivate.h"
#define BASIC "bynqiuxthdsog?"
#define N_BASIC (G_N_ELEMENTS (BASIC) - 1)
@@ -4779,7 +4780,7 @@ test_normal_checking_tuples (void)
GVariant *variant = NULL;
GVariant *normal_variant = NULL;
- aligned_data = g_memdup (data, size); /* guarantee alignment */
+ aligned_data = g_memdup2 (data, size); /* guarantee alignment */
variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
FALSE, NULL, NULL);
g_assert_nonnull (variant);
@@ -4908,7 +4909,7 @@ test_normal_checking_array_offsets (void)
GVariant *variant = NULL;
GVariant *normal_variant = NULL;
- aligned_data = g_memdup (data, size); /* guarantee alignment */
+ aligned_data = g_memdup2 (data, size); /* guarantee alignment */
variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
FALSE, NULL, NULL);
g_assert_nonnull (variant);
@@ -4935,7 +4936,7 @@ test_normal_checking_tuple_offsets (void)
GVariant *variant = NULL;
GVariant *normal_variant = NULL;
- aligned_data = g_memdup (data, size); /* guarantee alignment */
+ aligned_data = g_memdup2 (data, size); /* guarantee alignment */
variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data,
size, FALSE, NULL, NULL);
g_assert_nonnull (variant);
@@ -4962,7 +4963,7 @@ test_normal_checking_empty_object_path (void)
GVariant *variant = NULL;
GVariant *normal_variant = NULL;
- aligned_data = g_memdup (data, size); /* guarantee alignment */
+ aligned_data = g_memdup2 (data, size); /* guarantee alignment */
variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
FALSE, NULL, NULL);
g_assert_nonnull (variant);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]