From c47fbc86d50a0199fe9000a7df07609bb0a3bc77 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Fri, 13 Oct 2006 20:52:05 +0000 Subject: Increased default blocksize and added reject with explicit error message for WRQ request in case I can see the file is too big for us. git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@193 fe716a7a-6dde-0310-88d9-d003556173a8 --- diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp index bb15211..f41b69f 100644 --- a/PumpKINDlg.cpp +++ b/PumpKINDlg.cpp @@ -96,7 +96,7 @@ CPumpKINDlg::CPumpKINDlg(CWnd* pParent /*=NULL*/) 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); @@ -1033,6 +1033,10 @@ BOOL CWRQSocket::OnTFTP(tftp* p) 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(); @@ -1409,6 +1413,11 @@ tftp::tftpOptions oack; 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)); -- cgit v0.9.0.2