summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-16 11:27:51 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-16 11:27:51 +0000
commit96aca8fc70270a1d491b638eadace2ebc5456455 (patch)
treec76cb917903a8785dda241dc2c3c0eb397567744 /win32
parentcc07ecc3a6c82ded208481aa0b745507a13454bc (diff)
merge revision(s) 25656:
* 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_7@26113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/win32/win32.c b/win32/win32.c
index c9081327f5..c4b6a124ab 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1066,11 +1066,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);
}
}