From 1072ad1c2b1c1f55a3677b74f32635d3551a1aaa Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 26 Mar 2003 18:26:45 +0000 Subject: [PATCH] * string.c (rb_str_capitalize_bang): check length before upcase first character. (ruby-bugs:PR#697) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ string.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index f5b7547940..dde29576c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 27 03:26:40 2003 Nobuyoshi Nakada + + * string.c (rb_str_capitalize_bang): check length before upcase + first character. (ruby-bugs:PR#697) + Wed Mar 26 20:25:10 2003 Nobuyoshi Nakada * dln.c (dln_find_1): break if path list end, even for too long diff --git a/string.c b/string.c index a273400d89..02abb90b07 100644 --- a/string.c +++ b/string.c @@ -2092,6 +2092,7 @@ rb_str_capitalize_bang(str) int modify = 0; rb_str_modify(str); + if (RSTRING(str)->len == 0 || !RSTRING(str)->ptr) return Qnil; s = RSTRING(str)->ptr; send = s + RSTRING(str)->len; if (ISLOWER(*s)) { *s = toupper(*s);