Vulnerable Code

  • In the code, the difference between default encoding and byte array produced during encoding causes undefined behavior for inputs

Secure Code

  • The code explicitly specifies intended character encoding in the String constructor