summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-29 14:56:26 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-29 14:56:26 +0000
commit2a2fa6fd8b08871989d4d844e600331f95824e2f (patch)
tree51e14d4c617a4a996efc1dfc55dad6196dc659bd /util.c
parent4cc4305660ba9b670bb33c3b338b933171291df7 (diff)
downloadruby-2a2fa6fd8b08871989d4d844e600331f95824e2f.tar.gz
* util.c (mblen): fix overrun. [ruby-dev:22672]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r--util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.c b/util.c
index cb0b4912f4..437632861e 100644
--- a/util.c
+++ b/util.c
@@ -296,6 +296,8 @@ mblen(const char *s, size_t n)
if (s) {
if (n == 0 || *s == 0)
return 0;
+ else if (!s[1])
+ return 1;
return dbcs_table[(unsigned char)*s] + 1;
}
else