changeset 14109:9365fdf3a618

3967 iconv() blows up when passed (iconv_t)-1 Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
author Keith M Wesolowski <wesolows@foobazco.org>
date Thu, 01 Aug 2013 22:41:15 +0000
parents 8d40b8fbaa54
children 623d25456fad
files usr/src/lib/libc/port/gen/iconv.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libc/port/gen/iconv.c	Sun Jun 23 17:17:05 2013 -0400
+++ b/usr/src/lib/libc/port/gen/iconv.c	Thu Aug 01 22:41:15 2013 +0000
@@ -435,7 +435,7 @@
 	char **outbuf, size_t *outbytesleft)
 {
 	/* check if cd is valid */
-	if (cd == NULL) {
+	if (cd == NULL || cd == (iconv_t)-1) {
 		errno = EBADF;
 		return ((size_t)-1);
 	}