gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / glib-CVE-2021-27219-17.patch
CommitLineData
21b3b755
MW
1From 31e0d403ba635dbbacbfbff74295e5db02558d76 Mon Sep 17 00:00:00 2001
2From: Philip Withnall <pwithnall@endlessos.org>
3Date: Wed, 10 Feb 2021 21:19:30 +0000
4Subject: [PATCH 2/3] gkeyfilesettingsbackend: Disallow empty key or group
5 names
6
7These should never have been allowed; they will result in precondition
8failures from the `GKeyFile` later on in the code.
9
10A test will be added for this shortly.
11
12Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
13---
14 gio/gkeyfilesettingsbackend.c | 7 +++++++
15 1 file changed, 7 insertions(+)
16
17diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
18index 861c3a661..de216e615 100644
19--- a/gio/gkeyfilesettingsbackend.c
20+++ b/gio/gkeyfilesettingsbackend.c
21@@ -158,6 +158,13 @@ convert_path (GKeyfileSettingsBackend *kfsb,
22
23 last_slash = strrchr (key, '/');
24
25+ /* Disallow empty group names or key names */
26+ if (key_len == 0 ||
27+ (last_slash != NULL &&
28+ (*(last_slash + 1) == '\0' ||
29+ last_slash == key)))
30+ return FALSE;
31+
32 if (kfsb->root_group)
33 {
34 /* if a root_group was specified, make sure the user hasn't given
35--
362.30.1
37