* string.c (rb_str_rstrip_bang): don't access address -1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c45908e41f
commit
087f010ddb
4
string.c
4
string.c
@ -2828,9 +2828,7 @@ rb_str_rstrip_bang(str)
|
|||||||
e = t = s + RSTRING(str)->len;
|
e = t = s + RSTRING(str)->len;
|
||||||
|
|
||||||
/* remove trailing spaces */
|
/* remove trailing spaces */
|
||||||
t--;
|
while (s < t && ISSPACE(*(t-1))) t--;
|
||||||
while (s <= t && ISSPACE(*t)) t--;
|
|
||||||
t++;
|
|
||||||
|
|
||||||
RSTRING(str)->len = t-s;
|
RSTRING(str)->len = t-s;
|
||||||
if (t < e) {
|
if (t < e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user