Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add empty string check
  • Loading branch information
wvu committed Jul 18, 2019
1 parent f0b758e commit 77a442a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/rex/text/xor.rb
Expand Up @@ -29,6 +29,11 @@ def self.xor(key, value)
xor_key = [xor_key].pack('C')
end

# Check for empty strings
if xor_key.empty? || value.empty?
raise ArgumentError, 'XOR key and value must not be empty'
end

# Get byte arrays for key and value
xor_key = xor_key.bytes
xor_value = value.bytes
Expand Down

0 comments on commit 77a442a

Please sign in to comment.