Blame SOURCES/emacs-ob-latex-command-injection-vulnerability.patch

9fd46e
From a8006ea580ed74f27f974d60b598143b04ad1741 Mon Sep 17 00:00:00 2001
9fd46e
From: Xi Lu <lx@shellcodes.org>
9fd46e
Date: Sat, 11 Mar 2023 18:53:37 +0800
9fd46e
Subject: * lisp/org/ob-latex.el: Fix command injection vulnerability
9fd46e
9fd46e
(org-babel-execute:latex):
9fd46e
Replaced the `(shell-command "mv BAR NEWBAR")' with `rename-file'.
9fd46e
9fd46e
TINYCHANGE
9fd46e
---
9fd46e
 lisp/org/ob-latex.el | 13 +++++--------
9fd46e
 1 file changed, 5 insertions(+), 8 deletions(-)
9fd46e
9fd46e
diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el
9fd46e
index a2c24b3..ce39628 100644
9fd46e
--- a/lisp/org/ob-latex.el
9fd46e
+++ b/lisp/org/ob-latex.el
9fd46e
@@ -218,17 +218,14 @@ This function is called by `org-babel-execute-src-block'."
9fd46e
 	    (if (string-suffix-p ".svg" out-file)
9fd46e
 		(progn
9fd46e
 		  (shell-command "pwd")
9fd46e
-		  (shell-command (format "mv %s %s"
9fd46e
-					 (concat (file-name-sans-extension tex-file) "-1.svg")
9fd46e
-					 out-file)))
9fd46e
+                  (rename-file (concat (file-name-sans-extension tex-file) "-1.svg")
9fd46e
+                               out-file t))
9fd46e
 	      (error "SVG file produced but HTML file requested")))
9fd46e
 	   ((file-exists-p (concat (file-name-sans-extension tex-file) ".html"))
9fd46e
 	    (if (string-suffix-p ".html" out-file)
9fd46e
-		(shell-command "mv %s %s"
9fd46e
-			       (concat (file-name-sans-extension tex-file)
9fd46e
-				       ".html")
9fd46e
-			       out-file)
9fd46e
-	      (error "HTML file produced but SVG file requested")))))
9fd46e
+                (rename-file (concat (file-name-sans-extension tex-file) ".html")
9fd46e
+                             out-file t)
9fd46e
+              (error "HTML file produced but SVG file requested")))))
9fd46e
 	 ((or (string= "pdf" extension) imagemagick)
9fd46e
 	  (with-temp-file tex-file
9fd46e
 	    (require 'ox-latex)
9fd46e
-- 
9fd46e
cgit v1.1
9fd46e