summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-11-24 20:51:46 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-11-24 20:52:26 +0100
commit86b4bf7d3194a06281f053be341031d9196874c2 (patch)
tree96bcfbeb69df23b5ad252c7c6165cfad76575fa5 /libc
parent673f444013915fe2cfd30019b27bf3b8d1d34a4e (diff)
wchar: bug #1471: fix cornercase in mbrtowc
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/wchar/wchar.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index 7380ac9ae..ab6c617ed 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -286,6 +286,8 @@ size_t mbrtowc(wchar_t *__restrict pwc, const char *__restrict s,
s = empty_string;
n = 1;
} else if (*s == '\0') {
+ if (pwc)
+ *pwc = '\0';
/* According to the ISO C 89 standard this is the expected behaviour. */
return 0;
} else if (!n) {