From a60db057a2a8456f8f5b59a6c5805e25d1d47d34 Mon Sep 17 00:00:00 2001 From: eban Date: Wed, 5 Jul 2000 16:01:49 +0000 Subject: eban git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'win32') diff --git a/win32/win32.c b/win32/win32.c index 5780bff261..2bc633a214 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -872,13 +872,28 @@ insert(char *path, ListInfo *listinfo) } } +#ifdef HAVE_SYS_PARAM_H +# include +#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; -- cgit v1.2.3