|
| 1 | +From 8f8ec2ccf3f5ef8f38d68ec84a7e4739c45db485 Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Sat, 18 Feb 2023 18:03:28 +0800 |
| 4 | +Subject: * lisp/ob-latex.el (org-babel-execute:latex): Fix command injection |
| 5 | + vulnerability |
| 6 | + |
| 7 | +Link: https://orgmode.org/list/ [email protected] |
| 8 | + |
| 9 | +TINYCHANGE |
| 10 | +--- |
| 11 | + lisp/org/ob-latex.el | 2 +- |
| 12 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 13 | + |
| 14 | +diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el |
| 15 | +index 428907a..a0154bf 100644 |
| 16 | +--- a/lisp/org/ob-latex.el |
| 17 | ++++ b/lisp/org/ob-latex.el |
| 18 | +@@ -180,7 +180,7 @@ This function is called by `org-babel-execute-src-block'." |
| 19 | + tmp-pdf |
| 20 | + (list org-babel-latex-pdf-svg-process) |
| 21 | + extension err-msg log-buf))) |
| 22 | +- (shell-command (format "mv %s %s" img-out out-file))))) |
| 23 | ++ (rename-file img-out out-file t)))) |
| 24 | + ((string-suffix-p ".tikz" out-file) |
| 25 | + (when (file-exists-p out-file) (delete-file out-file)) |
| 26 | + (with-temp-file out-file |
| 27 | +-- |
| 28 | + |
| 29 | +From a8006ea580ed74f27f974d60b598143b04ad1741 Mon Sep 17 00:00:00 2001 |
| 30 | + |
| 31 | +Date: Sat, 11 Mar 2023 18:53:37 +0800 |
| 32 | +Subject: * lisp/ob-latex.el: Fix command injection vulnerability |
| 33 | + |
| 34 | +(org-babel-execute:latex): |
| 35 | +Replaced the `(shell-command "mv BAR NEWBAR")' with `rename-file'. |
| 36 | + |
| 37 | +TINYCHANGE |
| 38 | +--- |
| 39 | + lisp/org/ob-latex.el | 13 +++++-------- |
| 40 | + 1 file changed, 5 insertions(+), 8 deletions(-) |
| 41 | + |
| 42 | +diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el |
| 43 | +index a2c24b3..ce39628 100644 |
| 44 | +--- a/lisp/org/ob-latex.el |
| 45 | ++++ b/lisp/org/ob-latex.el |
| 46 | +@@ -218,17 +218,14 @@ This function is called by `org-babel-execute-src-block'." |
| 47 | + (if (string-suffix-p ".svg" out-file) |
| 48 | + (progn |
| 49 | + (shell-command "pwd") |
| 50 | +- (shell-command (format "mv %s %s" |
| 51 | +- (concat (file-name-sans-extension tex-file) "-1.svg") |
| 52 | +- out-file))) |
| 53 | ++ (rename-file (concat (file-name-sans-extension tex-file) "-1.svg") |
| 54 | ++ out-file t)) |
| 55 | + (error "SVG file produced but HTML file requested"))) |
| 56 | + ((file-exists-p (concat (file-name-sans-extension tex-file) ".html")) |
| 57 | + (if (string-suffix-p ".html" out-file) |
| 58 | +- (shell-command "mv %s %s" |
| 59 | +- (concat (file-name-sans-extension tex-file) |
| 60 | +- ".html") |
| 61 | +- out-file) |
| 62 | +- (error "HTML file produced but SVG file requested"))))) |
| 63 | ++ (rename-file (concat (file-name-sans-extension tex-file) ".html") |
| 64 | ++ out-file t) |
| 65 | ++ (error "HTML file produced but SVG file requested"))))) |
| 66 | + ((or (string= "pdf" extension) imagemagick) |
| 67 | + (with-temp-file tex-file |
| 68 | + (require 'ox-latex) |
| 69 | +-- |
0 commit comments