#include "SMTPCommand.h" namespace mail { int SMTPCommand::processCommand(coreutils::ZString &request, core::TCPSession &session) { // Same bug, same fix as IMAPCommand::processCommand's own doc // comment: session.server is a TCPServer* pointer, and casting // the pointer VALUE directly to a reference type reinterprets the // pointer FIELD'S OWN memory location as the object, not what it // points to. Confirmed live via gdb - this is the actual cause of // a real SIGSEGV in __SMTP_EHLO's very first use of // server.hostName (and every other handler reading // server.mailFileSystem was silently reading the same garbage, // just without happening to crash on it yet). Dereference first. return processCommand(request, (SMTPSession &)session, (SMTPServer &)(*session.server)); } int SMTPCommand::processCommand(coreutils::ZString &request, SMTPSession &session, SMTPServer &server) { return 0; } void SMTPCommand::grabInput(SMTPSession &session) { session.server->commands.grabInput(session, *this); } void SMTPCommand::clearGrab(SMTPSession &session) { session.server->commands.clearGrab(session); } }