summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-03-11 23:48:40 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-03-11 23:48:40 +0000
commita68dd11b7dbd73684616d2b5116671ee85854056 (patch)
treef2466b8f2dc6fcd12c299ae5c67a6a002aea1742 /Build/source
parentc59c766ac61971815ebca125dcac7b3291a7389d (diff)
Disable commands containing a character '|' for write18 in restricted mode for security.
git-svn-id: svn://tug.org/texlive/trunk@58283 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog5
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c12
2 files changed, 16 insertions, 1 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index be05b6cdcee..17f829704e3 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-12 Akira Kakuto <kakuto@w32tex.org>
+
+ * texmfmp.c: Disable commands containing a character '|' for
+ write18 in restricted mode for security.
+
2021-01-01 Akira Kakuto <kakuto@w32tex.org>
* printversion.c: Update copyright year.
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 8b898176e8a..eeb32eaf22c 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -610,8 +610,18 @@ runsystem (const char *cmd)
if (allow == 1)
status = system (cmd);
- else if (allow == 2)
+ else if (allow == 2) {
+/*
+ command including a character '|' is not allowed in
+ restricted mode for security.
+*/
+ size_t k;
+ for (k = 0; k < strlen (safecmd); k++) {
+ if (safecmd[k] == '|')
+ return 0;
+ }
status = system (safecmd);
+ }
/* Not really meaningful, but we have to manage the return value of system. */
if (status != 0)