Fix potential out-of-bounds access

Thanks to Beosin(https://github.com/Lianantech)
This commit is contained in:
Abit 2019-11-08 12:13:36 +01:00 committed by GitHub
parent ad3c881aa2
commit 1d028b3c15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -185,7 +185,7 @@ std::vector<header> parse_urlencoded_params( const std::string& f ) {
std::vector<header> h(num_args);
int arg = 0;
for( size_t i = 0; i < f.size(); ++i ) {
while( f[i] != '=' && i < f.size() ) {
while( i < f.size() && f[i] != '=' ) {
if( f[i] == '%' ) {
h[arg].key += char((fc::from_hex(f[i+1]) << 4) | fc::from_hex(f[i+2]));
i += 3;