[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gnulib] Re: iconv made easy
From: |
Paul Eggert |
Subject: |
[bug-gnulib] Re: iconv made easy |
Date: |
Sun, 26 Dec 2004 21:48:15 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Simon Josefsson <address@hidden> writes:
> + if (newsize <= outbuf_size
> + || !(newdest = realloc (dest, newsize)))
> + {
> + have_error = 1;
> + goto out;
> + }
If newsize <= outbuf_size, this sets have_error=1 and the remaining
code eventually uses errno. But errno is garbage at that point. You
need to set errno to ENOMEM in that case.
> + if (iconv_close (cd) < 0)
> + have_error = 1;
> + else
> + errno = save_errno;
> +
> + if (have_error && dest)
> + {
> + free (dest);
> + dest = NULL;
> + errno = save_errno;
> + }
Again, the resulting errno is incorrect if iconv_close returns a
negative number and dest is nonzero.
It might not hurt for you to review all the paths to the code that
uses errno, to make sure that it can't be garbage.
> I'm not sure about the cast of 'str' to 'ICONV_CONST char *'. Is
> iconv guaranteed to not modify the input string content?
I think so, but I think on some hosts the prototype is char * for
historical reasons.
- Re: [bug-gnulib] Re: iconv made easy, (continued)
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/13
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/15
- Re: [bug-gnulib] Re: iconv made easy, Paul Eggert, 2004/12/15
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/15
- Re: [bug-gnulib] Re: iconv made easy, Paul Eggert, 2004/12/15
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/15
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/25
- Re: [bug-gnulib] Re: iconv made easy, Paul Eggert, 2004/12/26
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/26
- [bug-gnulib] Re: iconv made easy,
Paul Eggert <=
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/27
- [bug-gnulib] Re: iconv made easy, Paul Eggert, 2004/12/28
- [bug-gnulib] Re: iconv made easy, Simon Josefsson, 2004/12/28
- [bug-gnulib] Re: iconv made easy, Paul Eggert, 2004/12/28