diff options
| author | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-05 16:01:49 +0000 |
|---|---|---|
| committer | eban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-05 16:01:49 +0000 |
| commit | 71898e529579cd40593098e619ed16346a861a50 (patch) | |
| tree | 79ba940de66214114e73fe0c12bbf56a65ba0968 | |
| parent | 7b256f03e0854cee97033fd9d38efc37c5be837f (diff) | |
| download | ruby-71898e529579cd40593098e619ed16346a861a50.tar.gz ruby-71898e529579cd40593098e619ed16346a861a50.tar.xz ruby-71898e529579cd40593098e619ed16346a861a50.zip | |
eban
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | win32/win32.c | 17 |
2 files changed, 21 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Jul 6 00:51:43 2000 WATANABE Hirofumi <eban@os.rim.or.jp> + + * win32/win32.c (NtCmdGlob): patterns should be separated and + NUL terminated. + Wed Jul 5 22:27:56 2000 WATANABE Hirofumi <eban@os.rim.or.jp> * cygwin/GNUmakefile: use ruby.def to make rubycw.dll. diff --git a/win32/win32.c b/win32/win32.c index 5780bff26..2bc633a21 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -872,13 +872,28 @@ insert(char *path, ListInfo *listinfo) } } +#ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +#else +# define MAXPATHLEN 512 +#endif + +void NtCmdGlob (NtCmdLineElement *patt) { ListInfo listinfo; + char buffer[MAXPATHLEN], *buf = buffer; listinfo.head = listinfo.tail = 0; - rb_glob(patt->str, insert, (VALUE)&listinfo); + if (patt->len >= MAXPATHLEN) + buf = ruby_xmalloc(patt->len + 1); + + strncpy(buf, patt->str, patt->len); + buf[patt->len] = 0; + rb_glob(buf, insert, (VALUE)&listinfo); + if (buf != buffer) + free(buf); if (listinfo.head && listinfo.tail) { listinfo.head->prev = patt->prev; |
