Skip to content

Commit 6e0d053

Browse files
Patch emacs for CVE-2025-1244 [High] (#12421)
Co-authored-by: jslobodzian <joslobo@microsoft.com>
1 parent 0f5d12a commit 6e0d053

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

SPECS/emacs/CVE-2025-1244.patch

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From 820f0793f0b46448928905552726c1f1b999062f Mon Sep 17 00:00:00 2001
2+
From: Xi Lu <lx@shellcodes.org>
3+
Date: Tue, 10 Oct 2023 22:20:05 +0800
4+
Subject: [PATCH] Fix man.el shell injection vulnerability
5+
6+
* lisp/man.el (Man-translate-references): Fix shell injection
7+
vulnerability. (Bug#66390)
8+
* test/lisp/man-tests.el (man-tests-Man-translate-references): New
9+
test.
10+
---
11+
lisp/man.el | 6 +++++-
12+
test/lisp/man-tests.el | 12 ++++++++++++
13+
2 files changed, 17 insertions(+), 1 deletion(-)
14+
15+
diff --git a/lisp/man.el b/lisp/man.el
16+
index 55cb9383bec1..d96396483d39 100644
17+
--- a/lisp/man.el
18+
+++ b/lisp/man.el
19+
@@ -761,7 +761,11 @@ and the `Man-section-translations-alist' variables)."
20+
(setq name (match-string 2 ref)
21+
section (match-string 1 ref))))
22+
(if (string= name "")
23+
- ref ; Return the reference as is
24+
+ ;; see Bug#66390
25+
+ (mapconcat 'identity
26+
+ (mapcar #'shell-quote-argument
27+
+ (split-string ref "\\s-+"))
28+
+ " ") ; Return the reference as is
29+
(if Man-downcase-section-letters-flag
30+
(setq section (downcase section)))
31+
(while slist
32+
diff --git a/test/lisp/man-tests.el b/test/lisp/man-tests.el
33+
index 140482ee6222..11f5f805e43f 100644
34+
--- a/test/lisp/man-tests.el
35+
+++ b/test/lisp/man-tests.el
36+
@@ -161,6 +161,18 @@ DESCRIPTION
37+
(let ((button (button-at (match-beginning 0))))
38+
(should (and button (eq 'Man-xref-header-file (button-type button))))))))))
39+
40+
+(ert-deftest man-tests-Man-translate-references ()
41+
+ (should (equal (Man-translate-references "basename")
42+
+ "basename"))
43+
+ (should (equal (Man-translate-references "basename(3)")
44+
+ "3 basename"))
45+
+ (should (equal (Man-translate-references "basename(3v)")
46+
+ "3v basename"))
47+
+ (should (equal (Man-translate-references ";id")
48+
+ "\\;id"))
49+
+ (should (equal (Man-translate-references "-k basename")
50+
+ "-k basename")))
51+
+
52+
(provide 'man-tests)
53+
54+
;;; man-tests.el ends here

SPECS/emacs/emacs.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Summary: GNU Emacs text editor
22
Name: emacs
33
Version: 29.4
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: GPLv3+ AND CC0-1.0
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
Group: Applications/Editors
99
URL: https://www.gnu.org/software/emacs/
1010
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
11+
Patch0: CVE-2025-1244.patch
1112
BuildRequires: gcc
1213
BuildRequires: glibc-devel
1314
BuildRequires: gnutls-devel
@@ -84,6 +85,9 @@ mkdir -p %{buildroot}%{_datadir}/emacs/site-lisp/site-start.d
8485
%dir %{_datadir}/emacs/site-lisp/site-start.d
8586

8687
%changelog
88+
* Sun Feb 16 2025 Kanishk Bansal <kanbansal@microsoft.com> - 29.4-2
89+
- Apply upstream patch to fix CVE-2025-1244
90+
8791
* Mon Jul 01 2024 Sharath Srikanth Chellappa <sharathsr@microsoft.com> - 29.4-1
8892
- Upgrade to 29.4 to fix CVE-2024-39331.
8993

0 commit comments

Comments
 (0)