php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18039 wrong length of output string
Submitted: 2002-06-28 03:09 UTC Modified: 2002-06-28 03:12 UTC
From: novicky at aarongroup dot cz Assigned:
Status: Closed Package: ICONV related
PHP Version: 4.2.1 OS: All
Private report: No CVE-ID: None
 [2002-06-28 03:09 UTC] novicky at aarongroup dot cz
There is a bug in ext/iconv/iconv.c file on line 234.

When you do not use libiconv and the output (translated) string is longer than the input string, you obtain a wrong length of the output string.

The problem is that there is an output buffer estimate (input buffer length + 32 bytes):

..
out_left = in_len + 32; /* Avoid realloc() most cases */ 
bsz = out_left;
..

but during output buffer realloc there is in_len used instead of bsz:

..
out_left = in_len;
..
out_size += bsz - out_left;
..

The correction should by made on line 234:

out_left = in_len;

should by:

out_left = bsz;



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-28 03:12 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 15:01:28 2024 UTC