diff options
author | 2008-08-23 07:51:35 +0000 | |
---|---|---|
committer | 2008-08-23 07:51:35 +0000 | |
commit | c59d7441e1d55e2065d63f280643aa4ca4f34323 (patch) | |
tree | 3ae2e93234bb35cc4e7f83cf4fd5f65927c7cc47 /lib/libc | |
parent | unbreak MALLOC_OPTIONS=G that I broke in my last commit; (diff) | |
download | wireguard-openbsd-c59d7441e1d55e2065d63f280643aa4ca4f34323.tar.xz wireguard-openbsd-c59d7441e1d55e2065d63f280643aa4ca4f34323.zip |
make mbstowcs(NULL, string, 0) correctly return the length of the
wchar_t string needed to represent "string", which in our case
is just strlen(string); feedback & "looks right" deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/locale/multibyte_sb.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/locale/multibyte_sb.c b/lib/libc/locale/multibyte_sb.c index 6f11625315d..4067b154b02 100644 --- a/lib/libc/locale/multibyte_sb.c +++ b/lib/libc/locale/multibyte_sb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: multibyte_sb.c,v 1.6 2005/12/10 02:01:51 deraadt Exp $ */ +/* $OpenBSD: multibyte_sb.c,v 1.7 2008/08/23 07:51:35 djm Exp $ */ /* $NetBSD: multibyte_sb.c,v 1.4 2003/08/07 16:43:04 agc Exp $ */ /* @@ -132,7 +132,8 @@ mbstowcs(wchar_t *pwcs, const char *s, size_t n) { /* pwcs may be NULL */ - /* s may be NULL */ + if (pwcs == NULL) + return strlen(s); return mbsrtowcs(pwcs, &s, n, NULL); } |