diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-10-10 12:08:44 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-10-10 12:08:44 +0000 |
commit | 1e5f142870e048b69d0e4cc148324a5998934e23 (patch) | |
tree | fb5e782fd50c4d51f289769a2d9d9c0144537524 /Build/source/texk | |
parent | a10fd8b6f5be9646d171a0f699a0a9a152ae41fd (diff) |
Modify determination of fullpath for restricted shell escape commands (from Akira)
git-svn-id: svn://tug.org/texlive/trunk@27937 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 21 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luatex.c | 14 |
4 files changed, 34 insertions, 11 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 2c426ba3816..9fac279d1e1 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,8 @@ +2012-10-10 Akira Kakuto <kakuto@fuk.kinidai.ac.jp> + + * texmfmp.c: Modify determination of fullpath for restricted shell + escape commands. + 2012-09-19 Peter Breitenlohner <peb@mppmu.mpg.de> * texmfmp.c: Since normalize_quotes() is declared static, diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index c641e37b1b4..51f4d8692da 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -205,7 +205,7 @@ Isspace (char c) static char **cmdlist = NULL; static void -mk_shellcmdlist (const char *v) +mk_shellcmdlist (char *v) { char **p; const char *q, *r1; @@ -246,9 +246,6 @@ mk_shellcmdlist (const char *v) *p = NULL; } -/* Called from maininit. Not static because also called from - luatexdir/lua/luainit.c. */ - static void init_shell_escape (void) { @@ -273,7 +270,7 @@ init_shell_escape (void) if (shellenabledp && restrictedshell == 1) { char *v2 = kpse_var_value ("shell_escape_commands"); if (v2) { - mk_shellcmdlist ((const char *)v2); + mk_shellcmdlist (v2); free (v2); } } @@ -452,9 +449,17 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname) { char *p, *q, *r; p = *safecmd; - if (!(IS_DIR_SEP (p[0]) && IS_DIR_SEP (p[1])) && - !(p[1] == ':' && IS_DIR_SEP (p[2]))) { - p = (char *) kpse_var_value ("SELFAUTOLOC"); + if (p[1] == ':' && !IS_DIR_SEP (p[2])) { + q = xmalloc (strlen (p) + 2); + q[0] = p[0]; + q[1] = p[1]; + q[2] = '\\'; + q[3] = '\0'; + strcat (q, (p + 2)); + free (*safecmd); + *safecmd = q; + } else if (!IS_DIR_SEP (p[0]) && !(p[1] == ':' && IS_DIR_SEP (p[2]))) { + p = kpse_var_value ("SELFAUTOLOC"); if (p) { r = *safecmd; while (*r && !Isspace(*r)) diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 3504753f824..d5d6f653a57 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,8 @@ +2012-10-10 Akira Kakuto <kakuto@fuk.kinidai.ac.jp> + + * luatex.c: Modify determination of fullpath for restricted shell + escape commands. + 2012-10-10 Peter Breitenlohner <peb@mppmu.mpg.de> Avoid TL vs W32TeX differences (from Akira). diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c index 190f080f59d..f0e7f4a22e0 100644 --- a/Build/source/texk/web2c/luatexdir/luatex.c +++ b/Build/source/texk/web2c/luatexdir/luatex.c @@ -353,9 +353,17 @@ int shell_cmd_is_allowed(const char *cmd, char **safecmd, char **cmdname) { char *p, *q, *r; p = *safecmd; - if (!(IS_DIR_SEP (p[0]) && IS_DIR_SEP (p[1])) && - !(p[1] == ':' && IS_DIR_SEP (p[2]))) { - p = (char *) kpse_var_value ("SELFAUTOLOC"); + if (p[1] == ':' && !IS_DIR_SEP (p[2])) { + q = xmalloc (strlen (p) + 2); + q[0] = p[0]; + q[1] = p[1]; + q[2] = '\\'; + q[3] = '\0'; + strcat (q, (p + 2)); + free (*safecmd); + *safecmd = q; + } else if (!IS_DIR_SEP (p[0]) && !(p[1] == ':' && IS_DIR_SEP (p[2]))) { + p = kpse_var_value ("SELFAUTOLOC"); if (p) { r = *safecmd; while (*r && !Isspace(*r)) |