Issue Bug Closed

#23036Read of uninitialized variable in t3lib_div::normalizeIPv6

Oliver Klee 06/29/10, 10:18 updated 10/02/18, 12:23

Description

$h is read before it is initialized:

public static function normalizeIPv6($address)    {
$normalizedAddress = ‘’;
$stageOneAddress = ‘’;
    $chunks = explode(‘::’, $address);    // Count 2 if if address has hidden zero blocks
if (count($chunks)==2) {
$chunksLeft = explode(‘:’, $chunks0);
$chunksRight = explode(‘:’, $chunks1);
$left = count($chunksLeft);
$right = count($chunksRight);
            // Special case: leading zero-only blocks count to 1, should be 0
if ($left==1 && strlen($chunksLeft0)==0) $left=0;
        $hiddenBlocks = 8 – ($left + $right);
$hiddenPart = ‘’;
while ($h<$hiddenBlocks) {
$hiddenPart .= ‘0000:’;
$h++;
}

(issue imported from #M14915)

Reviews 1