Module Name: src Committed By: joerg Date: Thu Jul 13 15:46:26 UTC 2017
Modified Files: src/lib/libc/citrus: citrus_none.c Log Message: Redo previous: catch NULL pointer earlier, check for empty string latter. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/lib/libc/citrus/citrus_none.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/citrus/citrus_none.c diff -u src/lib/libc/citrus/citrus_none.c:1.20 src/lib/libc/citrus/citrus_none.c:1.21 --- src/lib/libc/citrus/citrus_none.c:1.20 Thu Jul 13 15:44:45 2017 +++ src/lib/libc/citrus/citrus_none.c Thu Jul 13 15:46:26 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $ */ +/* $NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $ */ /*- * Copyright (c)2002 Citrus Project, @@ -28,7 +28,7 @@ #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $"); +__RCSID("$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $"); #endif /* LIBC_SCCS and not lint */ #include <assert.h> @@ -513,7 +513,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citru void * __restrict pspriv, size_t * __restrict nresult) { - if (s == NULL) { + if (s == NULL || *s == NULL) { *nresult = 0; return (0); } @@ -525,7 +525,7 @@ _citrus_NONE_stdenc_mbtowc(struct _citru if (pwc != NULL) *pwc = (_wc_t)(unsigned char) **s; - *nresult = *s == NULL ? 0 : 1; + *nresult = **s == '\0' ? 0 : 1; return (0); }