Quick fix to avoid dying on badly formatted imported data (looks like a Nessus import problem, actually)

git-svn-id: file:///home/svn/framework3/trunk@10499 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2010-09-27 23:06:13 +00:00
parent ea128c6404
commit dc79d360ac
1 changed files with 8 additions and 1 deletions

View File

@ -1927,7 +1927,14 @@ class DBManager
vuln_data[:workspace] = wspace vuln_data[:workspace] = wspace
vuln_data[:host] = host_address vuln_data[:host] = host_address
if vuln.elements["info"].text if vuln.elements["info"].text
vuln_data[:info] = YAML.load(vuln.elements["info"].text.to_s.strip) info = vuln.elements["info"].text.to_s.strip
begin
vuln_data[:info] = YAML.load(info)
rescue ::Exception # Oops, badly formed info.
dlog("Badly formatted vuln.info data from #{host_address} : '#{info}'")
vuln_data[:info] = nil
next
end
end end
vuln_data[:name] = vuln.elements["name"].text.to_s.strip vuln_data[:name] = vuln.elements["name"].text.to_s.strip
%w{created-at updated-at}.each { |datum| %w{created-at updated-at}.each { |datum|