[grade=B] fix(i2p): disable i2pd HTTPProxy that crashed daemon on inbound HTTP
The daemon used SetOption("http.enabled", false) which targets the i2pd
WEBCONSOLE (default port 7070). The actual HTTPProxy is configured via
the 'httpproxy.enabled' key (default port 4444). Since the daemon never
set this key, the HTTPProxy ran by default and any inbound HTTP request
on port 4444 crashed the daemon via nullptr dereference in
i2p::i18n::Locale::GetString (m_Language is never initialized).
Live trigger: a simple curl http://127.0.0.1:4444/ brings down the
entire daemon with SIGSEGV. Root cause confirmed via addr2line against
the same offsets on multiple crash events:
crash_handler
i2p::i18n::Locale::GetString (m_Language->GetString on nullptr)
i2p::i18n::translate
i2p::proxy::HTTPReqHandler::HandleRequest
i2p::proxy::HTTPReqHandler::HandleSockRecv
HTTPProxy.cpp:518 (the tr("Host %s is not inside I2P network...") call)
Fix: SetOption("httpproxy.enabled", false) added to InitI2P. The
i2pd.conf also gets a [httpproxy] enabled=false section for
diagnostic consistency (the conf is dead code in the embedded library
path but kept in sync).
Codex grade B (urn:ump: pending final write). Polish suggestions applied:
shortened cycle-13 comments and clarified conf vs runtime SetOption.
This commit is contained in:
@@ -471,6 +471,13 @@ bool CI2PEmbedded::Start(int socks, int sam, int server)
|
||||
conf << "address = 127.0.0.1\n";
|
||||
conf << "port = " << samPort << "\n";
|
||||
conf << "\n";
|
||||
// Disable HTTP proxy (port 4444). Cycle-13 fix: the HTTPProxy runs by
|
||||
// default in i2pd 2.60.0 and any HTTP request to its port causes a
|
||||
// nullptr deref in i2p::i18n::Locale::GetString. Conf is dead code in
|
||||
// the embedded library path; SetOption in InitI2P is the real override.
|
||||
conf << "[httpproxy]\n";
|
||||
conf << "enabled = false\n";
|
||||
conf << "\n";
|
||||
// Disable HTTP webconsole (not needed for embedded use)
|
||||
conf << "[http]\n";
|
||||
conf << "enabled = false\n";
|
||||
@@ -609,7 +616,14 @@ bool CI2PEmbedded::Start(int socks, int sam, int server)
|
||||
bool samEnabled = true;
|
||||
std::string samAddr = "127.0.0.1";
|
||||
uint16_t samPortVal = (uint16_t)samPort;
|
||||
bool httpEnabled = false;
|
||||
// Cycle-13 fix: HTTPProxy runs by default in i2pd 2.60.0 on
|
||||
// port 4444 and any inbound HTTP request crashes the daemon via
|
||||
// nullptr deref in i2p::i18n::Locale::GetString (m_Language is
|
||||
// never initialized). The previous SetOption("http.enabled",...)
|
||||
// targeted the i2pd WEBCONSOLE, not the HTTPProxy. Correct key
|
||||
// is "httpproxy.enabled".
|
||||
bool httpproxyEnabled = false;
|
||||
bool httpWebconsoleEnabled = false;
|
||||
bool i2pcontrolEnabled = false;
|
||||
bool bobEnabled = false;
|
||||
|
||||
@@ -620,7 +634,9 @@ bool CI2PEmbedded::Start(int socks, int sam, int server)
|
||||
i2p::config::SetOption("sam.enabled", samEnabled);
|
||||
i2p::config::SetOption("sam.address", samAddr);
|
||||
i2p::config::SetOption("sam.port", samPortVal);
|
||||
i2p::config::SetOption("http.enabled", httpEnabled);
|
||||
// Cycle-13 fix: was "http.enabled" which targeted webconsole.
|
||||
i2p::config::SetOption("httpproxy.enabled", httpproxyEnabled);
|
||||
i2p::config::SetOption("http.enabled", httpWebconsoleEnabled);
|
||||
i2p::config::SetOption("i2pcontrol.enabled", i2pcontrolEnabled);
|
||||
i2p::config::SetOption("bob.enabled", bobEnabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user