summaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-09 18:41:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-09 18:41:35 +0000
commit1ca5143193379d73a01c2ccdabe0d280cf73a47a (patch)
treed019e96a644151602262533c6ab22292e6258e52 /sprintf.c
parentba2f457dbe087457bec046e7e5fb9e4c8cc07650 (diff)
downloadruby-1ca5143193379d73a01c2ccdabe0d280cf73a47a.tar.gz
ruby-1ca5143193379d73a01c2ccdabe0d280cf73a47a.tar.xz
ruby-1ca5143193379d73a01c2ccdabe0d280cf73a47a.zip
* sprintf.c (rb_str_format): check if codepoint for %c is valid.
[ruby-dev:36691] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index 0085cfc17..34152b170 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -618,7 +618,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
c = NUM2INT(val);
}
n = rb_enc_codelen(c, enc);
- if (n == 0) {
+ if (n <= 0) {
rb_raise(rb_eArgError, "invalid character");
}
if (!(flags & FWIDTH)) {