Skip to content

Commit 7596d21

Browse files
jvazquez-r7Brent Cook
authored andcommitted
Use length for comparision
1 parent e903044 commit 7596d21

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/rex/post/meterpreter/client_core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def migrate(pid, writable_dir="/tmp/")
239239
if client.platform =~ /linux/i
240240
socket_path = File.join(writable_dir, Rex::Text.rand_text_alpha_lower(5 + rand(5)))
241241

242-
if socket_path > UNIX_PATH_MAX - 1
242+
if socket_path.length > UNIX_PATH_MAX - 1
243243
raise RuntimeError, "The writable dir is too long", caller
244244
end
245245

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def cmd_migrate(*args)
351351
end
352352

353353
if client.platform =~ /linux/
354-
writable_dir = (args.length >= 2) ? args[1] : "/tmp/"
354+
writable_dir = (args.length >= 2) ? args[1] : "/tmp/"
355355
end
356356

357357
begin
@@ -395,9 +395,9 @@ def cmd_migrate(*args)
395395

396396
# Do this thang.
397397
if client.platform =~ /linux/
398-
client.core.migrate(pid)
399-
else
400398
client.core.migrate(pid, writable_dir)
399+
else
400+
client.core.migrate(pid)
401401
end
402402

403403
print_status("Migration completed successfully.")

0 commit comments

Comments
 (0)