bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] Re: iconvme again


From: Simon Josefsson
Subject: [bug-gnulib] Re: iconvme again
Date: Tue, 22 Feb 2005 20:52:50 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

Paul Eggert <address@hidden> writes:

> Simon Josefsson <address@hidden> writes:
>
>> Hello.  iconvme.* has been installed into libc.  This patch propose to
>> add it to gnulib via libc.  What do you think?
>
> There was something wrong with that email.  It claimed to have a file
> iconvme.h, but the contents of that file were identical to the
> contents of iconvme.c.  What caused that problem?  Can you please
> resubmit the suggestion?

Oops!  A mistaken 'cp'.  The iconvme.h is as below.

> I did notice one unchecked arithmetic overflow.  This:
>
>> +  size_t outbuf_size = (inbytes_remaining + 1) * MB_LEN_MAX;
>
> can overflow and cause buffer overruns.  I suggest adding something
> like this as a conservative check, just after the declarations:
>
>     if (1 < MB_LEN_MAX && SIZE_MAX / MB_LEN_MAX <= inbytes_remaining)
>       {
>         errno = ENOMEM;
>         return NULL;
>       }

Neat, I have filed a libc bug report about it:

http://sources.redhat.com/bugzilla/show_bug.cgi?id=756

Thanks.
/* Recode strings between character sets, using iconv.
   Copyright (C) 2004 Free Software Foundation, Inc.
   Written by Simon Josefsson.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License 
along
   with this program; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#ifndef ICONVME_H
# define ICONVME_H

extern char *iconv_string (const char *string, const char *from_code,
                           const char *to_code);

#endif /* ICONVME_H */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]