mirror of
https://github.com/znc/znc.git
synced 2026-07-05 17:31:06 +02:00
identfile: read original spoof with ReadFile
Read() returned up to 1024 bytes into a stack buffer that was then assigned to a CString via the const char* overload, so strlen() walked past the end of buf when the file filled all 1024 bytes without a NUL. ReadFile() bounds the append by the byte count Read() returns and reads the whole file, so the original contents also round-trip faithfully.
This commit is contained in:
@@ -111,10 +111,7 @@ class CIdentFileModule : public CModule {
|
||||
return false;
|
||||
}
|
||||
|
||||
char buf[1024];
|
||||
memset((char*)buf, 0, 1024);
|
||||
m_pISpoofLockFile->Read(buf, 1024);
|
||||
m_sOrigISpoof = buf;
|
||||
m_pISpoofLockFile->ReadFile(m_sOrigISpoof);
|
||||
|
||||
if (!m_pISpoofLockFile->Seek(0) || !m_pISpoofLockFile->Truncate()) {
|
||||
delete m_pISpoofLockFile;
|
||||
|
||||
Reference in New Issue
Block a user