From 6825f77323fd140d8cf8d407eed2fccbfec5e298 Mon Sep 17 00:00:00 2001 From: tarui Date: Wed, 20 Apr 2011 16:15:35 +0000 Subject: * win32/win32.c (CreateChild): maximum length of lpCommandLine is 32,768 characters, including the Unicode terminating null character. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ win32/win32.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8563299b33..2ffd04b0b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Apr 21 01:01:28 2011 Masaya Tarui + + * win32/win32.c (CreateChild): maximum length of lpCommandLine is + 32,768 characters, including the Unicode terminating null character. + Wed Apr 20 21:32:11 2011 Tadayoshi Funaba * ext/date/date_strptime.c (date__strptime_internal): do not diff --git a/win32/win32.c b/win32/win32.c index 5aea1b5e78..6dafecb079 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1060,6 +1060,12 @@ CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa, dwCreationFlags = (NORMAL_PRIORITY_CLASS); + if (lstrlenW(cmd) > 32767) { + child->pid = 0; /* release the slot */ + errno = E2BIG; + return NULL; + } + RUBY_CRITICAL({ fRet = CreateProcessW(prog, (WCHAR *)cmd, psa, psa, psa->bInheritHandle, dwCreationFlags, NULL, NULL, -- cgit v1.2.3