Project

General

Profile

Actions

Bug #12749

closed

Uninitialized array in ``array_remove_duplicates()``

Added by Viktor Gurov almost 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Viktor Gurov
Category:
DHCP (IPv6)
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
22.05
Release Notes:
Default
Affected Version:
2.5.2
Affected Architecture:

Description

https://github.com/pfsense/pfsense/blob/master/src/etc/inc/util.inc#L3322-L3333:

function array_remove_duplicate($array, $field) {
    foreach ($array as $sub) {
        if (isset($sub[$field])) {
            $cmp[] = $sub[$field];
        }
    }
    $unique = array_unique(array_reverse($cmp, true));
    foreach ($unique as $k => $rien) {
        $new[] = $array[$k];
    }
    return $new;
}

$cmp is not initialized with an empty array, and if all conditions are failed, $cmp == null

see https://forum.netgate.com/topic/169564/with-2-6rc-warning-array_reverse-expects-parameter-1-to-be-array-null-given

Actions #2

Updated by Jim Pingle almost 3 years ago

  • Status changed from New to Pull Request Review
  • Assignee set to Viktor Gurov
  • Target version set to 2.7.0
  • Plus Target Version set to 22.05
Actions #3

Updated by Viktor Gurov almost 3 years ago

  • Status changed from Pull Request Review to Feedback
  • % Done changed from 0 to 100
Actions #4

Updated by Jim Pingle over 2 years ago

  • Subject changed from Uninitialized array in array_remove_duplicates() to Uninitialized array in ``array_remove_duplicates()``

Updating subject for release notes.

Actions #5

Updated by Jim Pingle over 2 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF