Skip to content

Commit cc58922

Browse files
[AUTO-CHERRYPICK] Patch emacs for CVE-2025-1244 [High] - branch 3.0-dev (#12490)
Co-authored-by: Kanishk Bansal <103916909+Kanishk-Bansal@users.noreply.github.com>
1 parent 587591e commit cc58922

2 files changed

Lines changed: 60 additions & 2 deletions

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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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: Azure Linux
@@ -10,6 +10,7 @@ URL: https://www.gnu.org/software/emacs/
1010
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
1111
Source1: site-start.el
1212
Source2: default.el
13+
Patch0: CVE-2025-1244.patch
1314
BuildRequires: gcc
1415
BuildRequires: glibc-devel
1516
BuildRequires: gnutls-devel
@@ -35,7 +36,7 @@ This package provides some directories which are required by other
3536
packages that add functionality to Emacs.
3637

3738
%prep
38-
%autosetup
39+
%autosetup -p1
3940

4041
%build
4142
%configure \
@@ -128,6 +129,9 @@ rm -f *-filelist {common,el}-*-files
128129
%dir %{_datadir}/emacs/site-lisp/site-start.d
129130

130131
%changelog
132+
* Sun Feb 16 2025 Kanishk Bansal <kanbansal@microsoft.com> - 29.4-2
133+
- Apply upstream patch to fix CVE-2025-1244
134+
131135
* Mon Jun 24 2024 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 29.4-1
132136
- Auto-upgrade to 29.4 - CVE
133137

0 commit comments

Comments
 (0)