aboutsummaryrefslogtreecommitdiff
path: root/iconv/gconv.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconv/gconv.c')
-rw-r--r--iconv/gconv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/iconv/gconv.c b/iconv/gconv.c
index 0cbb052a6d..5df16354b6 100644
--- a/iconv/gconv.c
+++ b/iconv/gconv.c
@@ -30,6 +30,9 @@ __gconv (gconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
size_t oldinbytes = *inbytesleft;
int result;
+ if (cd == (gconv_t) -1L)
+ return GCONV_ILLEGAL_DESCRIPTOR;
+
cd->data[last_step].outbuf = *outbuf;
cd->data[last_step].outbufavail = 0;
cd->data[last_step].outbufsize = *outbytesleft;