mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
string.c: out-of-bounds access
* string.c (rb_str_enumerate_lines): fix out-of-bounds access when record separator is longer than the last element. [Bug #14257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
660740a75d
commit
e043ae7348
1 changed files with 2 additions and 1 deletions
3
string.c
3
string.c
|
@ -8026,7 +8026,8 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, VALUE ary)
|
|||
if (rsnewline) {
|
||||
pend = chomp_newline(subptr, pend, enc);
|
||||
}
|
||||
else if (memcmp(pend - rslen, rsptr, rslen) == 0) {
|
||||
else if (pend - subptr >= rslen &&
|
||||
memcmp(pend - rslen, rsptr, rslen) == 0) {
|
||||
pend -= rslen;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue