Opened 15 years ago
Closed 15 years ago
#177 closed defect (fixed)
QProcess::startDetached() fails to pass arguments
| Reported by: | rudi | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | Qt 4.6.3 |
| Component: | QtCore | Version: | 4.6.2 |
| Severity: | high | Keywords: | |
| Cc: |
Description
In some cases arguments are not passed correctly to the child process. The reason is than QByteArray::size() does not count the trailing zero. Thus the argument strings might be unterminated.
Index: qprocess_os2.cpp
===================================================================
--- qprocess_os2.cpp (revision 758)
+++ qprocess_os2.cpp (working copy)
@@ -993,12 +993,12 @@
// DosStartSession() as it cannot work with high memory
PSZ pgmNameLow = (PSZ)::_lmalloc(::strlen(programReal) + 1);
::strcpy(pgmNameLow, programReal);
- PSZ argsLow = (PSZ)::_lmalloc(args.size());
- ::memcpy(argsLow, args, args.size());
+ PSZ argsLow = (PSZ)::_lmalloc(args.size() + 1);
+ ::memcpy(argsLow, args, args.size() + 1);
PSZ envLow = 0;
if (!env.isEmpty()) {
- envLow = (PSZ)::_lmalloc(env.size());
- ::memcpy(envLow, env, env.size());
+ envLow = (PSZ)::_lmalloc(env.size() + 1);
+ ::memcpy(envLow, env, env.size() + 1);
}
#else
PSZ pgmNameLow = (PSZ)programReal;
Change History (2)
comment:1 by , 15 years ago
| Milestone: | Qt Enhanced → Qt 4.6.3 |
|---|
comment:2 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

Rudi, thanks for spotting it. Fixed in r761.