about summary refs log tree commit diff
path: root/src/multibyte/mbrtowc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/multibyte/mbrtowc.c')
-rw-r--r--src/multibyte/mbrtowc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/multibyte/mbrtowc.c b/src/multibyte/mbrtowc.c
index 35e834ee..e7b36540 100644
--- a/src/multibyte/mbrtowc.c
+++ b/src/multibyte/mbrtowc.c
@@ -14,6 +14,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate
 	unsigned c;
 	const unsigned char *s = (const void *)src;
 	const unsigned N = n;
+	wchar_t dummy;
 
 	if (!st) st = (void *)&internal_state;
 	c = *(unsigned *)st;
@@ -21,7 +22,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate
 	if (!s) {
 		if (c) goto ilseq;
 		return 0;
-	} else if (!wc) wc = (void *)&wc;
+	} else if (!wc) wc = &dummy;
 
 	if (!n) return -2;
 	if (!c) {