PurpleI2P / i2pd

🛡 I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website
BSD 3-Clause "New" or "Revised" License
3.26k stars 423 forks source link

Unsanitized input from a file flows into an addition operator (+), where it is used in integer arithmetic. This may result in an integer overflow vulnerability. #2115

Closed s-b-repo closed 3 days ago

s-b-repo commented 4 days ago
                std::string header;
                size_t contentLength = 0;
                while (!ss.eof () && header != "\r")
                {
                    std::getline(ss, header);
                    auto colon = header.find (':');
                    if (colon != std::string::npos && header.substr (0, colon) == "Content-Length")
                        contentLength = std::stoi (header.substr (colon + 1));
                }
                if (ss.eof ())
                {
                    LogPrint (eLogError, "I2PControl: Malformed request, HTTP header expected");
                    return; // TODO:
                }
                std::streamoff rem = contentLength + ss.tellg () - bytes_transferred; // more bytes to read
orignal commented 3 days ago

Please, stop posting ChatGPT's output here.

s-b-repo commented 20 hours ago

its not chatgpt

s-b-repo commented 20 hours ago

im using automated code analysis software

orignal commented 14 hours ago

There is no "input from a file" in this code.