summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2021-02-04 13:50:37 +0000
committerSimon McVittie <smcv@collabora.com>2021-03-19 10:26:12 +0000
commit7f308de341f2fd76d3f42f3e0e626683fef6ff0c (patch)
tree20f362265da51c545f76952f30aae2c71ce3d3f8
parent5c26b6a7f656feeb09ecccb573e6ac6b9e9dbfd8 (diff)
downloadglib-wip/2-58-cve-2021-27219.tar.gz
gwin32: Use gsize internally in g_wcsdup()wip/2-58-cve-2021-27219
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>
-rw-r--r--gio/gwin32appinfo.c2
-rw-r--r--gio/gwin32registrykey.c2
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);
}
/**