mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* re.c (rb_reg_initialize): should not modify untainted objects in
safe levels higher than 3. * re.c (rb_memcmp): type change from char* to const void*. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bb73409497
commit
1b3beecb54
4 changed files with 22 additions and 12 deletions
6
string.c
6
string.c
|
@ -1130,7 +1130,7 @@ rb_str_index_m(argc, argv, str)
|
|||
{
|
||||
int c = FIX2INT(sub);
|
||||
long len = RSTRING(str)->len;
|
||||
unsigned char *p = RSTRING(str)->ptr;
|
||||
unsigned char *p = (unsigned char*)RSTRING(str)->ptr;
|
||||
|
||||
for (;pos<len;pos++) {
|
||||
if (p[pos] == c) return LONG2NUM(pos);
|
||||
|
@ -1252,8 +1252,8 @@ rb_str_rindex_m(argc, argv, str)
|
|||
case T_FIXNUM:
|
||||
{
|
||||
int c = FIX2INT(sub);
|
||||
unsigned char *p = RSTRING(str)->ptr + pos;
|
||||
unsigned char *pbeg = RSTRING(str)->ptr;
|
||||
unsigned char *p = (unsigned char*)RSTRING(str)->ptr + pos;
|
||||
unsigned char *pbeg = (unsigned char*)RSTRING(str)->ptr;
|
||||
|
||||
if (pos == RSTRING(str)->len) {
|
||||
if (pos == 0) return Qnil;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue