From f6ba0f692ed4a2a0f4a2cfb2d6787c680af3f5e1 Mon Sep 17 00:00:00 2001 From: pfg Date: Mon, 27 Nov 2017 02:44:36 +0000 Subject: [PATCH] MFC r326028: iconv: Fix a pointer mismatch. Catch NULL pointer earlier, check for empty string later. Apparently this fixes a GCC8 warning. Obtained from: NetBSD (CVS Rev. 1.21, 1.22) through DragonFlyBSD git-svn-id: svn://svn.freebsd.org/base/stable/10@326241 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libc/iconv/citrus_none.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/iconv/citrus_none.c b/lib/libc/iconv/citrus_none.c index 9ec4bd360..ff3c85d94 100644 --- a/lib/libc/iconv/citrus_none.c +++ b/lib/libc/iconv/citrus_none.c @@ -164,7 +164,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused, struct iconv_hooks *hooks) { - if (s == NULL) { + if (*s == NULL) { *nresult = 0; return (0); } @@ -176,7 +176,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citrus_stdenc * __restrict ce __unused, if (pwc != NULL) *pwc = (_wc_t)(unsigned char) **s; - *nresult = *s == '\0' ? 0 : 1; + *nresult = **s == '\0' ? 0 : 1; if ((hooks != NULL) && (hooks->wc_hook != NULL)) hooks->wc_hook(*pwc, hooks->data); -- 2.42.0