Skip to content

Commit 97d08a0

Browse files
David MaloneyDavid Maloney
authored andcommitted
reverting port 0 behaviour in portspec
a change was made to protspec that allowed port 0 when we explicitly dissallowed port 0. This change caused other code that depended on this behaviour to break
1 parent 3ed7050 commit 97d08a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/rex/socket.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,11 @@ def self.portspec_to_portlist(pspec)
534534
end
535535

536536
if ports.empty? and not remove.empty? then
537-
ports = 0.upto 65535
537+
ports = 1.upto 65535
538538
end
539539

540540
# Sort, and remove dups and invalid ports
541-
ports.sort.uniq.delete_if { |p| p < 0 or p > 65535 or remove.include? p }
541+
ports.sort.uniq.delete_if { |p| p < 1 or p > 65535 or remove.include? p }
542542
end
543543

544544
#
@@ -551,7 +551,7 @@ def self.portlist_to_portspec(parr)
551551
lastp = nil
552552

553553
parr.uniq.sort{|a,b| a<=>b}.map{|a| a.to_i}.each do |n|
554-
next if (n < 0 or n > 65535)
554+
next if (n < 1 or n > 65535)
555555
if not lastp
556556
range = [n]
557557
lastp = n

0 commit comments

Comments
 (0)