[glib/wip/2-58-cve-2021-27219: 3/3] gwin32: Use gsize internally in g_wcsdup()
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/2-58-cve-2021-27219: 3/3] gwin32: Use gsize internally in g_wcsdup()
- Date: Fri, 19 Mar 2021 10:08:13 +0000 (UTC)
commit 8367c73da4e9edde670132dd5cf471c8217b892d
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Feb 4 13:50:37 2021 +0000
gwin32: Use gsize internally in g_wcsdup()
This allows it to handle strings up to length `G_MAXSIZE` — previously
it would overflow with such strings.
Update the several copies of it identically.
Adapted for GLib 2.58 by Simon McVittie.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #2319
[Backport to 2.58 branch: g_wcsdup() existed in different places]
Signed-off-by: Simon McVittie <smcv collabora com>
gio/gwin32appinfo.c | 2 +-
gio/gwin32registrykey.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c
index 9f335b370..2a0fe380d 100644
--- a/gio/gwin32appinfo.c
+++ b/gio/gwin32appinfo.c
@@ -472,7 +472,7 @@ g_wcsdup (const gunichar2 *str, gssize str_size)
str_size = wcslen (str) + 1;
str_size *= sizeof (gunichar2);
}
- return g_memdup (str, str_size);
+ return g_memdup2 (str, str_size);
}
#define URL_ASSOCIATIONS
L"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\"
diff --git a/gio/gwin32registrykey.c b/gio/gwin32registrykey.c
index 619fd48af..1c5526315 100644
--- a/gio/gwin32registrykey.c
+++ b/gio/gwin32registrykey.c
@@ -136,7 +136,7 @@ g_wcsdup (const gunichar2 *str,
str_size = wcslen (str) + 1;
str_size *= sizeof (gunichar2);
}
- return g_memdup (str, str_size);
+ return g_memdup2 (str, str_size);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]