summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--PumpKINDlg.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index bb15211..f41b69f 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -93,13 +93,13 @@ CPumpKINDlg::CPumpKINDlg(CWnd* pParent /*=NULL*/)
m_RetryTimeOut = CTimeSpan(0,0,0,10);
m_LogLength = 100;
m_SpeakPort = 69;
m_PromptTimeOut=30;
m_bShown=TRUE;
m_bExiting=FALSE;
- m_BlockSize=1024;
+ m_BlockSize=2048;
m_bnw.AssignSound("(bang)",IDR_WAVE_RING,CBellsNWhistles::CBang::bangResource);
m_bnw.AssignSound("(done)",IDR_WAVE_FINISHED,CBellsNWhistles::CBang::bangResource);
m_bnw.AssignSound("(oops)",IDR_WAVE_ABORTED,CBellsNWhistles::CBang::bangResource);
m_bnw.AssignSound("(none)",(int)0,CBellsNWhistles::CBang::bangNone);
m_bnwRequest="(bang)"; m_bnwSuccess="(done)";
m_bnwAbort="(oops)";
@@ -1030,12 +1030,16 @@ BOOL CWRQSocket::OnTFTP(tftp* p)
return TRUE;
}
}
if(o.Lookup(tftpoTSize,v)){
m_xferSize=atoi(v);
}
+ if(m_xferSize>=0 && m_xferSize>=(m_blkSize<<16)) {
+ Deny(tftp::errUndefined,IDS_TFTP_ERROR_TOOBIG);
+ return TRUE;
+ }
}
UpdateList();
DoXfer();
}
break;
case tftp::opDATA:
@@ -1406,12 +1410,17 @@ tftp::tftpOptions oack;
if(m_Options.Lookup(tftpoXResume,v) && m_bResume){
m_ACK=m_File.GetLength()/m_blkSize;
v.Format("%u",m_ACK);
oack[tftpoXResume]=v;
}else
m_ACK=0;
+ // XXX: see if we can negotiate the right block size somehow
+ if(m_xferSize>=0 && m_xferSize>=(m_blkSize<<16)) {
+ Deny(tftp::errUndefined,IDS_TFTP_ERROR_TOOBIG);
+ return TRUE;
+ }
state=stateXfer;
if(oack.GetCount()){
tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&oack));
ASSERT(p);
p->SetOpcode(tftp::opOACK);
p->data.m_OACK.Set(&oack);