Skip to content

Commit 1922795

Browse files
committed
BufferRegister should be validated.
If BufferRegister is in lower-case, then gen_decoder_prefix will return nil. When the return value is nil, other functions like gen_decoder() will backtrace due to a "undefined method "+" for nil" error. Therefore, this input should NOT be case-sensitive. Also, if for some reason the user supplies an invalid BufferRegister, the function should be aware of that and warn the user about the bad input.
1 parent 0527a7e commit 1922795

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/rex/encoder/alpha2/unicode_mixed.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ def self.gen_decoder_prefix(reg, offset)
3939
'EDI' => 'WWYA' + mod, # push edi, pop edi
4040
}
4141

42-
return regprefix[reg]
42+
prefix = regprefix[reg.upcase]
43+
if prefix.nil?
44+
raise "Critical: Invalid register"
45+
end
46+
47+
return prefix
4348
end
4449

4550
def self.gen_decoder(reg, offset)

0 commit comments

Comments
 (0)