Changeset - 8f7a62c72706
[Not reviewed]
0 1 0
Jan Kaluza - 13 years ago 2012-10-23 11:28:54
hanzz.k@gmail.com
Fix crash when data for unknown filetransfer has been received
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/networkpluginserver.cpp
Show inline comments
 
@@ -754,24 +754,29 @@ void NetworkPluginServer::handleFTFinishPayload(const std::string &data) {
 

	
 
void NetworkPluginServer::handleFTDataPayload(Backend *b, const std::string &data) {
 
	pbnetwork::FileTransferData payload;
 
	if (payload.ParseFromString(data) == false) {
 
		// TODO: ERROR
 
		return;
 
	}
 

	
 
// 	User *user = m_userManager->getUser(payload.username());
 
// 	if (!user)
 
// 		return;
 

	
 
	if (m_filetransfers.find(payload.ftid()) == m_filetransfers.end()) {
 
		LOG4CXX_ERROR(logger, "Uknown filetransfer with id " << payload.ftid());
 
		return;
 
	}
 

	
 
	FileTransferManager::Transfer &transfer = m_filetransfers[payload.ftid()];
 
	MemoryReadBytestream *bytestream = (MemoryReadBytestream *) transfer.readByteStream.get();
 

	
 
	if (bytestream->appendData(payload.data()) > 5000000) {
 
		pbnetwork::FileTransferData f;
 
		f.set_ftid(payload.ftid());
 
		f.set_data("");
 

	
 
		std::string message;
 
		f.SerializeToString(&message);
 

	
 
		WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_FT_PAUSE);
0 comments (0 inline, 0 general)