diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-26 07:30:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-26 07:30:37 +0000 |
commit | 079009fb93678e902777669c663ed6f651a05c85 (patch) | |
tree | 7f2d849ba6f739d3022f1353d411a7935362c683 /file.c | |
parent | adcd0174b97e09f3f1f1651f9d2399167ac313ee (diff) | |
download | ruby-079009fb93678e902777669c663ed6f651a05c85.tar.gz |
file.c: fix buffer overflow
* 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/trunk@43853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2618,6 +2618,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); |