Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Possible bug in mb.inc.php  (Read 3539 times)

0 Members and 1 Guest are viewing this topic.

Pit

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 24
    • http://www.ibforen.de
Possible bug in mb.inc.php
« on: December 05, 2005, 11:54:23 pm »

There seems to be a bug in include/mb.inc.php function mb_substr():

While trying to bridge cpg to ipb I have noticed that all group names of ipb have been imported only with the first character. This happened on a server where I didn't have activated mbstring library in php.ini. Testing the error in my local environment I found the bug in mb.inc.php.

In the original code of mb_substr you call array_slice always with parameter length (here $end) even when that parameter is null. In my php installation (4.4.1)  array_slice returns only the $start element of the array instead of the entire rest of it.

Code: [Select]
        function mb_substr($str, $start, $end=null) {
                global $mb_utf8_regex;
                preg_match_all("#$mb_utf8_regex".'|[\x00-\x7F]#', $str, $str);
                $str = array_slice($str[0], $start, $end);
                return implode('', $str);
        }

To avoid this behavior I have had to modify the function:
Code: [Select]
        function mb_substr($str, $start, $end=null) {
                global $mb_utf8_regex;
                preg_match_all("#$mb_utf8_regex".'|[\x00-\x7F]#', $str, $str);
                if ($end == null)
                    $str = array_slice($str[0], $start);
                else
                    $str = array_slice($str[0], $start, $end);
                return implode('', $str);
        }

Perhaps you can verify this as a bug.
« Last Edit: December 08, 2005, 11:53:47 pm by GauGau »
Logged
I do not code for or support Invisionboard 2.x

Nibbler

  • Guest
Re: Possible bug in mb.inc.php
« Reply #1 on: December 06, 2005, 12:05:21 am »

Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 15 queries.