diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-20 17:17:52 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-07-20 17:17:52 +0000 |
commit | e4de8e756634e95ff3cdbd7563153bc8270fca2e (patch) | |
tree | 5c3201101689d42be50fa18dae58fa326cf296f3 /bignum.c | |
parent | 6a867d33b5aa4ed67800cd64fe19d2902250bd96 (diff) |
* string.c: use StringValueCStr to retrieve paths to system calls.
* string.c (rb_string_value_cstr): check null byte in the string
before retrieving C ptr. accessed via macro StringValueCStr.
* file.c (sys_fail2): raise error for two operand system calls
such as rename, link, symlink. (ruby-bugs PR#1047)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -507,7 +507,12 @@ rb_str_to_inum(str, base, badcheck) long len; StringValue(str); - s = RSTRING(str)->ptr; + if (badcheck) { + s = StringValueCStr(str); + } + else { + s = RSTRING(str)->ptr; + } if (s) { len = RSTRING(str)->len; if (s[len]) { /* no sentinel somehow */ @@ -517,9 +522,6 @@ rb_str_to_inum(str, base, badcheck) p[len] = '\0'; s = p; } - if (badcheck && len != strlen(s)) { - rb_raise(rb_eArgError, "string for Integer contains null byte"); - } } return rb_cstr_to_inum(s, base, badcheck); } |