mirror of
https://github.com/znc/znc.git
synced 2026-05-18 07:15:54 +02:00
Fix an integer overflow bug in the DCC code
The issue happened if off_t was a signed, 4 byte integer (x86). In this case (off_t) 0xffffffff is -1 and a file size is always larger than -1 which unconditionally caused the "File too large" error to trigger. Thanks to [Deton8r] for reporting this bug and flakes for debugging it. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1568 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+2
-2
@@ -186,8 +186,8 @@ CFile* CDCCSock::OpenFile(bool bWrite) {
|
||||
|
||||
// The DCC specs only allow file transfers with files smaller
|
||||
// than 4GiB (see ReadData()).
|
||||
off_t uFileSize = m_pFile->GetSize();
|
||||
if (uFileSize > (off_t) 0xffffffff) {
|
||||
unsigned long long uFileSize = m_pFile->GetSize();
|
||||
if (uFileSize > (unsigned long long) 0xffffffff) {
|
||||
delete m_pFile;
|
||||
m_pFile = NULL;
|
||||
m_pUser->PutModule(m_sModuleName, "DCC -> [" + m_sRemoteNick + "] - File too large (>4 GiB) [" + m_sLocalFile + "]");
|
||||
|
||||
Reference in New Issue
Block a user