diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-13 11:47:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-13 11:47:45 +0000 |
commit | e57289d2084f97f13534e060c05204bff47c7b8a (patch) | |
tree | 4660f3f9b38ceb146455f527c0e540f20701f5d4 /string.c | |
parent | 56260ece997c1b628a4e4e4403e6624e9a888aa9 (diff) | |
download | ruby-e57289d2084f97f13534e060c05204bff47c7b8a.tar.gz |
string.c (rb_str_set_len): pathological check
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2574,7 +2574,7 @@ rb_str_set_len(VALUE str, long len) if (STR_SHARED_P(str)) { rb_raise(rb_eRuntimeError, "can't set length of shared string"); } - if (len > (capa = (long)str_capacity(str, termlen))) { + if (len > (capa = (long)str_capacity(str, termlen)) || len < 0) { rb_bug("probable buffer overflow: %ld for %ld", len, capa); } STR_SET_LEN(str, len); |