Opened 10 years ago
Last modified 10 years ago
#343 new defect
exec deliberately escapes double quotes
Reported by: | dmik | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | new |
Component: | libc | Version: | 0.6.6 |
Severity: | normal | Keywords: | |
Cc: |
Description
I found out that the exec*
call (and spawn
as well I assume) deliberately escapes double quote characters in arguments with a backslash. This is fine for binaries that are built with kLIBC itself as this will be unescaped back before calling main
(so that the application will not even notice this). However, it screws binaries based on other runtimes (e.g. rexx.exe
or wrc.exe
).
Change History (2)
comment:2 by , 10 years ago
IIRC, there is some heuristic in one of the exec
worker functions that decides if it should escape double quotes and so me other *nix related stuff but if so then it breaks in the mentioned cases for some reason.
The test case:
parent.c:
child.cmd
:If you start
parent.exe
, the output will be:This will completely screw up the target program which doesn't expect
"
to be escaped this way. The real life case of such a screw up screw up iswrc.exe
. See here http://trac.netlabs.org/ports/ticket/60. And http://trac.netlabs.org/kbuild/ticket/113 seems to be a similar case as well.In the test case above
cmd.exe
is used to process the REXX script socmd.exe
is affected as well (expectedly).