From 86b4bf7d3194a06281f053be341031d9196874c2 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 24 Nov 2010 20:51:46 +0100 Subject: wchar: bug #1471: fix cornercase in mbrtowc Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/wchar/wchar.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libc/misc/wchar') 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) { -- cgit v1.2.3