mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
merge revision(s) 43853: [Backport #9157]
* file.c (rb_readlink): fix buffer overflow on a long symlink. since rb_str_modify_expand() expands from its length but not its capacity, need to set the length properly for each expansion. [ruby-core:58592] [Bug #9157] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@43959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dd7ec71b12
commit
83c337f29a
4 changed files with 30 additions and 4 deletions
1
file.c
1
file.c
|
@ -2531,6 +2531,7 @@ rb_readlink(VALUE path)
|
|||
) {
|
||||
rb_str_modify_expand(v, size);
|
||||
size *= 2;
|
||||
rb_str_set_len(v, size);
|
||||
}
|
||||
if (rv < 0) {
|
||||
rb_str_resize(v, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue