From 7596d211e9eae061649c5a98596917a42f74dd87 Mon Sep 17 00:00:00 2001 From: jvazquez-r7 Date: Thu, 31 Jul 2014 13:11:00 -0500 Subject: [PATCH] Use length for comparision --- lib/rex/post/meterpreter/client_core.rb | 2 +- .../post/meterpreter/ui/console/command_dispatcher/core.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rex/post/meterpreter/client_core.rb b/lib/rex/post/meterpreter/client_core.rb index f51af6d97a..d4efe35d98 100644 --- a/lib/rex/post/meterpreter/client_core.rb +++ b/lib/rex/post/meterpreter/client_core.rb @@ -239,7 +239,7 @@ class ClientCore < Extension if client.platform =~ /linux/i socket_path = File.join(writable_dir, Rex::Text.rand_text_alpha_lower(5 + rand(5))) - if socket_path > UNIX_PATH_MAX - 1 + if socket_path.length > UNIX_PATH_MAX - 1 raise RuntimeError, "The writable dir is too long", caller end diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb index 37ef968b36..1210bfd21a 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb @@ -351,7 +351,7 @@ class Console::CommandDispatcher::Core end if client.platform =~ /linux/ - writable_dir = (args.length >= 2) ? args[1] : "/tmp/" + writable_dir = (args.length >= 2) ? args[1] : "/tmp/" end begin @@ -395,9 +395,9 @@ class Console::CommandDispatcher::Core # Do this thang. if client.platform =~ /linux/ - client.core.migrate(pid) - else client.core.migrate(pid, writable_dir) + else + client.core.migrate(pid) end print_status("Migration completed successfully.")