Issue with snmpwalk_group string splitting (#12701)

* handling invalid data for snmpwalk_group

* style

* new approach

* new guess

* split trim

* cleaning
This commit is contained in:
PipoCanaja 2021-04-05 22:47:11 +02:00 committed by GitHub
parent 61b4c35ab1
commit 8c2a5d5a16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}