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