From ef3dbf38413d76885fa272d865a4358e13978373 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Tue, 6 Jul 2010 18:35:49 +0000 Subject: [PATCH] Workaround for Ruby 1.8's fragile Marshal code git-svn-id: file:///home/svn/framework3/trunk@9689 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/db.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/db.rb b/lib/msf/core/db.rb index cba718dd5c..9cd84d5d44 100644 --- a/lib/msf/core/db.rb +++ b/lib/msf/core/db.rb @@ -2594,7 +2594,12 @@ class DBManager return nil if not string return nil if string.empty? begin - Marshal.load(string.unpack("m")[0]) + # Validate that it is properly formed base64 first + if string.gsub(/\s+/, '') =~ /^([a-z0-9A-Z\+\/=]+)$/ + Marshal.load($1.unpack("m")[0]) + else + string + end rescue ::Exception => e if allow_yaml YAML.load(string) rescue string