fix nil sysDescr crashing vendor identification
String.contains?/2 crashes on nil input. default nil sysDescr and sysObjectID to empty string in find_vendor_match.
This commit is contained in:
parent
c9f154f8cd
commit
1a31fd00b6
1 changed files with 3 additions and 0 deletions
|
|
@ -1346,6 +1346,9 @@ defmodule Towerops.Snmp.Profiles.Base do
|
|||
end
|
||||
|
||||
defp find_vendor_match(sys_descr, sys_object_id) do
|
||||
sys_descr = sys_descr || ""
|
||||
sys_object_id = sys_object_id || ""
|
||||
|
||||
Enum.find_value(@vendor_patterns, fn {descr_patterns, oid_patterns, manufacturer, extractor} ->
|
||||
descr_match = descr_patterns != [] and String.contains?(sys_descr, descr_patterns)
|
||||
oid_match = oid_patterns != [] and String.contains?(sys_object_id, oid_patterns)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue