Project

General

Profile

Actions

Bug #12749

closed

Uninitialized array in ``array_remove_duplicates()``

Added by Viktor Gurov 5 months ago. Updated 28 days 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 5 months 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 4 months ago

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

Updated by Jim Pingle 3 months 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 28 days ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF