Branch: Tag:

2014-10-17

2014-10-17 12:19:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

_Roxen: Fixed buffer overrun in http_decode_string().

Also increases the strictness of a few related testsuite tests.

11:   test_eq(_Roxen.http_decode_string(""), "")   test_eq(_Roxen.http_decode_string("abc+d%20e%41"), "abc+d eA")   test_eq(_Roxen.http_decode_string(""), "") - test_do(_Roxen.http_decode_string("%")) - test_do(_Roxen.http_decode_string("%0")) - test_do(_Roxen.http_decode_string("%%")) - test_do(_Roxen.http_decode_string("%%%")) - test_do(_Roxen.http_decode_string("%41%")) - test_do(_Roxen.http_decode_string("%41%0")) - test_do(_Roxen.http_decode_string("%41%%")) - test_do(_Roxen.http_decode_string("%41%%%")) - test_do(_Roxen.http_decode_string("%u")) - test_do(_Roxen.http_decode_string("%u0")) - test_do(_Roxen.http_decode_string("%u00")) - test_do(_Roxen.http_decode_string("%u000")) - test_do(_Roxen.http_decode_string("%u000_")) - test_do(_Roxen.http_decode_string("%41%u")) - test_do(_Roxen.http_decode_string("%41%u0")) - test_do(_Roxen.http_decode_string("%41%u00")) - test_do(_Roxen.http_decode_string("%41%u000")) - test_do(_Roxen.http_decode_string("%41%u000_")) + test_eq(_Roxen.http_decode_string("+"), "+") +  + // The following inputs are all illegal, but are allowed + // for compat reasons. + test_eq(_Roxen.http_decode_string("%"), "\0") + test_eq(_Roxen.http_decode_string("%0"), "\0") + test_eq(_Roxen.http_decode_string("%%"), "\0") + test_eq(_Roxen.http_decode_string("%%%"), "U") + test_eq(_Roxen.http_decode_string("%41%"), "A\0") + test_eq(_Roxen.http_decode_string("%41%0"), "A\0") + test_eq(_Roxen.http_decode_string("%41%%"), "A\0") + test_eq(_Roxen.http_decode_string("%41%%%"), "AU") + test_eq(_Roxen.http_decode_string("%u"), "\0") + test_eq(_Roxen.http_decode_string("%u0"), "\0") + test_eq(_Roxen.http_decode_string("%u00"), "\0") + test_eq(_Roxen.http_decode_string("%u000"), "\0") + test_eq(_Roxen.http_decode_string("%u000_"), "\b") + test_eq(_Roxen.http_decode_string("%41%u"), "A\0") + test_eq(_Roxen.http_decode_string("%41%u0"), "A\0") + test_eq(_Roxen.http_decode_string("%41%u00"), "A\0") + test_eq(_Roxen.http_decode_string("%41%u000"), "A\0") + test_eq(_Roxen.http_decode_string("%41%u000_"), "A\b") +    test_eq(_Roxen.http_decode_string("%u12345"), "\x1234""5")   test_eq(_Roxen.http_decode_string("%U12345"), "\x1234""5")