diff options
Diffstat (limited to 'iconv')
-rw-r--r-- | iconv/gconv.c | 2 | ||||
-rw-r--r-- | iconv/iconv.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/iconv/gconv.c b/iconv/gconv.c index 6e3080b..b9c404a 100644 --- a/iconv/gconv.c +++ b/iconv/gconv.c @@ -39,7 +39,7 @@ __gconv (__gconv_t cd, const unsigned char **inbuf, assert (converted != NULL); *converted = 0; - cd->__data[last_step].__outbuf = *outbuf; + cd->__data[last_step].__outbuf = outbuf != NULL ? *outbuf : NULL; cd->__data[last_step].__outbufend = outbufend; if (inbuf == NULL || *inbuf == NULL) diff --git a/iconv/iconv.c b/iconv/iconv.c index ee16d3b..c1b9616 100644 --- a/iconv/iconv.c +++ b/iconv/iconv.c @@ -39,9 +39,12 @@ iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, if (inbuf == NULL || *inbuf == NULL) { - result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf, - (unsigned char *) (outstart + *outbytesleft), - &converted); + if (outbuf == NULL || *outbuf == NULL) + result = __gconv (gcd, NULL, NULL, NULL, NULL, &converted); + else + result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf, + (unsigned char *) (outstart + *outbytesleft), + &converted); } else { |