Diff
Not logged in

Differences From Artifact [99c9be83aa]:

To Artifact [97a5d0f4ad]:


232
233
234
235
236
237
238
239
240
241




242
243
244
245
246
247




248
249
250
251
252
253
254
255
256

257
258
259
260
261
262
263

264
265
266
267
268
269
270
232
233
234
235
236
237
238



239
240
241
242
243





244
245
246
247
248
249
250
251
252
253
254
255

256
257
258
259
260
261
262

263
264
265
266
267
268
269
270







-
-
-
+
+
+
+

-
-
-
-
-
+
+
+
+








-
+






-
+







an argument to the batch files (\fB.cmd\fR or \fB.bat\fR) or to the command
processor (\fBcmd.exe /c\fR), because this causes truncation of command-line
(also the argument chain) on the first newline character.
But it works properly with an executable (using CommandLineToArgv, etc).
.PP
\fBArgument quoting\fR
.RS
Each argument of the \fBexec\fR command is mapped to an argument of the called
program by an adaptive quoting by adding quote characters (\fB"\fR) around the
arguments.
The arguments of the \fBexec\fR command are mapped to the arguments of the called
program. Additional quote characters (\fB"\fR) are automatically  added around
arguments if expected. Special characters are escaped by inserting backslash
characters.
.PP
If invoking batch files or other specific programs, the Windows environment
does execute programs mentioned in the arguments or replace environment
variables, which may have side effects (vulnerabilities) or break any already
existing quoting (for example, if the environment variable contains a special
character like a \fB"\fR).
The MS-Windows environment does execute programs mentioned in the arguments and
called batch files (conspec) replace environment variables, which may have side
effects (vulnerabilities) or break any already existing quoting (for example,
if the environment variable contains a special character like a \fB"\fR).
Examples are:
.CS
% exec my-echo.cmd {test&whoami}
  test
  mylogin
% exec my-echo.cmd "ENV X:%X%"
  ENV X: CONTENT OF X
.CE
In consequence, the following formatting is automatically performed on any
The following formatting is automatically performed on any
argument item:
.IP \(bu 3
Avoid subprogram execution:
Any special character argument containing a special character (\fB&\fR, \fB|\fR,
\fB^\fR, \fB<\fR, \fB>\fR, \fB!\fR, \fB(\fR, \fB)\fR, \fB(\fR, \fB%\fR)
is automatically enclosed in quotes (\fB"\fR). Any data quote is escaped by
appropriate sequences.
insertion of backslash characters.
.IP \(bu 3
Avoid environment variable replacement:
Any appearence of environment variable reference (\fB%\fR) is individually quoted
by \fB"\fR.
.PP
TCL 8.6.10 refined this quoting by adding quoting for data quotes and individual
quoting of "\fB%\fR".