diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-05 02:33:14 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-05 02:33:14 +0000 |
| commit | e9f4ba613e603e626f53d4cbd260db0a7ba4c50b (patch) | |
| tree | 8e60804b14b597d09a8eaa24564349c9ddb4e215 | |
| parent | a41271104bce8fb4721dbbc63ce70f428b5a1186 (diff) | |
* win32/win32.c (CreateChild): allocate temporary buffer and use it
instead of directly modify the passed string. [ruby-dev:39635]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | win32/win32.c | 12 |
2 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,8 @@ +Thu Nov 5 11:31:23 2009 NAKAMURA Usaku <usa@ruby-lang.org> + + * win32/win32.c (CreateChild): allocate temporary buffer and use it + instead of directly modify the passed string. [ruby-dev:39635] + Sat Oct 31 17:20:58 2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org> * lib/net/http.rb (Net::HTTPResponse#each_response_header): diff --git a/win32/win32.c b/win32/win32.c index 94147a5acf..397374f8be 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1091,11 +1091,13 @@ CreateChild(const char *cmd, const char *prog, SECURITY_ATTRIBUTES *psa, } } if (p) { - shell = p; - while (*p) { - if ((unsigned char)*p == '/') - *p = '\\'; - p = CharNext(p); + char *tmp = ALLOCA_N(char, strlen(p) + 1); + strcpy(tmp, p); + shell = tmp; + while (*tmp) { + if ((unsigned char)*tmp == '/') + *tmp = '\\'; + tmp = CharNext(tmp); } } |
