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:
rootvector2
2026-06-09 17:14:27 +05:30
parent 56ed5c3f94
commit 28b9971e83
+1 -4
View File
@@ -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;