Skip to contentSkip to conversation

glib-2.0: fix CVE-2021-28153

PATCH New Chen Qi 1 participant 1 message Apr 25, 2021

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/1 glib-2.0: fix CVE-2021-28153

Backport patches to fix CVE-2021-28153.

---
 ...outputstream-Fix-a-typo-in-a-comment.patch |  32 ++
 ...-using-g_test_bug_base-in-file-tests.patch |  47 +++
 ...outputstream-Factor-out-a-flag-check.patch |  60 ++++
 ...stream-Fix-CREATE_REPLACE_DESTINATIO.patch | 294 ++++++++++++++++++
 ...stream-Add-a-missing-O_CLOEXEC-flag-.patch |  60 ++++
 meta/recipes-core/glib-2.0/glib-2.0_2.66.7.bb |  10 +
 6 files changed, 503 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0001-glocalfileoutputstream-Fix-a-typo-in-a-comment.patch
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0002-tests-Stop-using-g_test_bug_base-in-file-tests.patch
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0003-glocalfileoutputstream-Factor-out-a-flag-check.patch
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0004-glocalfileoutputstream-Fix-CREATE_REPLACE_DESTINATIO.patch
 create mode 100644 meta/recipes-core/glib-2.0/glib-2.0/0005-glocalfileoutputstream-Add-a-missing-O_CLOEXEC-flag-.patch
meta/recipes-core/glib-2.0/glib-2.0/0001-glocalfileoutputstream-Fix-a-typo-in-a-comment.patch new file +32 -0
new file mode 100644
index 0000000000..e3def1a980
@@ -0,0 +1,32 @@
+From 48dd0d030a2b5240457472d40d8691b80bf5fa78 Mon Sep 17 00:00:00 2001
+From: Philip Withnall <[email protected]>
+Date: Wed, 24 Feb 2021 17:33:38 +0000
+Subject: [PATCH 1/5] glocalfileoutputstream: Fix a typo in a comment
+
+Signed-off-by: Philip Withnall <[email protected]>
+
+CVE: CVE-2021-28153
+
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/issues/2325]
+
+Signed-off-by: Chen Qi <[email protected]>
+---
+ gio/glocalfileoutputstream.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
+index f34c3e4..e3d31d6 100644
+--- a/gio/glocalfileoutputstream.c
++++ b/gio/glocalfileoutputstream.c
+@@ -854,7 +854,7 @@ handle_overwrite_open (const char    *filename,
+   mode = mode_from_flags_or_info (flags, reference_info);
+ 
+   /* We only need read access to the original file if we are creating a backup.
+-   * We also add O_CREATE to avoid a race if the file was just removed */
++   * We also add O_CREAT to avoid a race if the file was just removed */
+   if (create_backup || readable)
+     open_flags = O_RDWR | O_CREAT | O_BINARY;
+   else
+-- 
+2.17.1
+
meta/recipes-core/glib-2.0/glib-2.0/0002-tests-Stop-using-g_test_bug_base-in-file-tests.patch new file +47 -0

47 lines not on this page · raw message

meta/recipes-core/glib-2.0/glib-2.0/0003-glocalfileoutputstream-Factor-out-a-flag-check.patch new file +60 -0

60 lines not on this page · raw message

meta/recipes-core/glib-2.0/glib-2.0/0004-glocalfileoutputstream-Fix-CREATE_REPLACE_DESTINATIO.patch new file +294 -0

294 lines not on this page · raw message

meta/recipes-core/glib-2.0/glib-2.0/0005-glocalfileoutputstream-Add-a-missing-O_CLOEXEC-flag-.patch new file +60 -0

60 lines not on this page · raw message

meta/recipes-core/glib-2.0/glib-2.0_2.66.7.bb +10 -0
index 3909b76ddf..e5e65a4aad 100644
@@ -50,6 +50,16 @@ SRC_URI += "\
            file://0028-gresource-Fix-a-pointer-mismatch-with-an-atomic-load.patch \
            file://0029-docs-Document-not-to-use-volatile-qualifiers.patch \
 "
+
+# Fix CVE-2021-28153
+SRC_URI += "\
+           file://0001-glocalfileoutputstream-Fix-a-typo-in-a-comment.patch \
+           file://0002-tests-Stop-using-g_test_bug_base-in-file-tests.patch \
+           file://0003-glocalfileoutputstream-Factor-out-a-flag-check.patch \
+           file://0004-glocalfileoutputstream-Fix-CREATE_REPLACE_DESTINATIO.patch \
+           file://0005-glocalfileoutputstream-Add-a-missing-O_CLOEXEC-flag-.patch \
+"
+
 SRC_URI_append_class-native = " file://relocate-modules.patch"
 
 SRC_URI[sha256sum] = "09f158769f6f26b31074e15b1ac80ec39b13b53102dfae66cfe826fb2cc65502"
Signature · 1 line
2.17.1