From 8c2a5d5a160309672113c24367cbda89d75d52a4 Mon Sep 17 00:00:00 2001 From: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com> Date: Mon, 5 Apr 2021 22:47:11 +0200 Subject: [PATCH] Issue with snmpwalk_group string splitting (#12701) * handling invalid data for snmpwalk_group * style * new approach * new guess * split trim * cleaning --- includes/snmp.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index 057c1d50d7..037dacbbe2 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -675,7 +675,9 @@ function snmpwalk_group($device, $oid, $mib = '', $depth = 1, $array = [], $mibd // merge the parts into an array, creating keys if they don't exist $tmp = &$array; foreach ($parts as $part) { - $tmp = &$tmp[trim($part, '".')]; + // we don't want to remove dots inside quotes, only outside + $key = trim(trim($part, '.'), '"'); + $tmp = &$tmp[$key]; } $tmp = trim($value, "\" \n\r"); // assign the value as the leaf }