summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index f2b9161a7dd..6bfe2ea1338 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -415,14 +415,18 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
r = *safecmd;
while (*r && !Isspace(*r))
r++;
- *r = '\0';
- r++;
- while (*r && Isspace(*r))
- r++;
- if (*r)
- q = (char *) concatn ("\"", p, "/", *safecmd, "\" ", r, NULL);
- else
+ if (*r == '\0')
q = (char *) concatn ("\"", p, "/", *safecmd, "\"", NULL);
+ else {
+ *r = '\0';
+ r++;
+ while (*r && Isspace(*r))
+ r++;
+ if (*r)
+ q = (char *) concatn ("\"", p, "/", *safecmd, "\" ", r, NULL);
+ else
+ q = (char *) concatn ("\"", p, "/", *safecmd, "\"", NULL);
+ }
free (p);
free (*safecmd);
*safecmd = q;