summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-18 07:47:15 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-18 07:47:15 +0000
commit992923053cfb51dc04c6a7ee07ca6fff1b61d1a5 (patch)
tree2b2857adc35295dcd45c57c338c440ec16f99eff /dir.c
parent16487ee284f17cfbf6fad9f6b2fedc57f0f37e0a (diff)
1.1b9_26
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/dir.c b/dir.c
index be3ee4247f..cce2572e7b 100644
--- a/dir.c
+++ b/dir.c
@@ -371,22 +371,23 @@ push_braces(ary, s)
}
static VALUE
-dir_s_glob(dir, vstr)
- VALUE dir, vstr;
+dir_s_glob(dir, str)
+ VALUE dir, str;
{
char *p, *pend;
char buf[MAXPATHLEN];
char *t, *t0;
int nest;
VALUE ary;
- struct RString *str;
- Check_SafeStr(vstr);
- str = RSTRING(vstr);
+ Check_SafeStr(str);
+ if (RSTRING(str)->len > MAXPATHLEN) {
+ ArgError("pathname too long (%d bytes)", RSTRING(str)->len);
+ }
ary = ary_new();
- p = str->ptr;
- pend = p + str->len;
+ p = RSTRING(str)->ptr;
+ pend = p + RSTRING(str)->len;
while (p < pend) {
t = buf;