From 07d322c997ca8a03db61d2e3a5560cb1ec28da4a Mon Sep 17 00:00:00 2001 From: pfg Date: Mon, 27 Nov 2017 02:43:27 +0000 Subject: 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 --- lib/libc/iconv/citrus_none.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/iconv/citrus_none.c b/lib/libc/iconv/citrus_none.c index 9ec4bd3..56e157a 100644 --- a/lib/libc/iconv/citrus_none.c +++ b/lib/libc/iconv/citrus_none.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_none.c,v 1.18 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_none.c,v 1.22 2017/07/13 16:00:30 christos Exp $ */ /*- * Copyright (c) 2002 Citrus Project, @@ -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); -- cgit v1.1