summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-27 10:24:24 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-27 10:24:24 +0000
commitd79a41f2ca56ba840b02b4dcc193f120ab97e4b0 (patch)
treefc0bb2410cd09b4fbbcb7a41e8d04d2a7239094a /string.c
parentc41a952564ed4ae98c644fc77f1a03206f327bb3 (diff)
downloadruby-d79a41f2ca56ba840b02b4dcc193f120ab97e4b0.tar.gz
ruby-d79a41f2ca56ba840b02b4dcc193f120ab97e4b0.tar.xz
ruby-d79a41f2ca56ba840b02b4dcc193f120ab97e4b0.zip
* string.c (rb_str_rstrip_bang): don't access address -1.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/string.c b/string.c
index a4f597f2a..49b0c7add 100644
--- a/string.c
+++ b/string.c
@@ -2828,9 +2828,7 @@ rb_str_rstrip_bang(str)
e = t = s + RSTRING(str)->len;
/* remove trailing spaces */
- t--;
- while (s <= t && ISSPACE(*t)) t--;
- t++;
+ while (s < t && ISSPACE(*(t-1))) t--;
RSTRING(str)->len = t-s;
if (t < e) {