wxString wxFTP::Pwd()
{
wxString path;
if ( CheckCommand(wxT("PWD"), '2') )
{
// the result is at least that long if CheckCommand() succeeded
wxString::const_iterator p = m_lastResult.begin() + LEN_CODE + 1;
if ( *p != wxT('"') )
{
wxLogDebug(wxT("Missing starting quote in reply for PWD: %s"),
wxString(p, m_lastResult.end()));
}
else
{
for ( ++p; *p; ++p )
{
if ( *p == wxT('"') )
{
// check if the quote is doubled
++p;
if ( !*p || *p != wxT('"') ) <<----------- ERROR: string iterator not dereferencable WTF???
{
// no, this is the end
break;
}
//else: yes, it is: this is an embedded quote in the
// filename, treat as normal char
}
path += *p;
}
if ( !*p )
{
wxLogDebug(wxT("Missing ending quote in reply for PWD: %s"),
m_lastResult.c_str() + LEN_CODE + 1);
}
}
}
else
{
m_lastError = wxPROTO_PROTERR;
wxLogDebug(wxT("FTP PWD command failed."));
}
return path;
}
What does "p" point to at the moment of the crash?
It looks that the ftp server returns something the parser is not prepared for. If that's the case, please open a bug report at: http://trac.wxwidgets.org
It's a little hard to tell what exactly is going on without being able to trace through it myself. But i looks like a bug in the parsing code. So i'd suggest to open a bug report.