summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-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)