#745: fixed crash caused by malformed nzb files

: for file elements not having subject attribute a (somewhat) random
subject is generated and is used as file name; correct file names are
read from articles later anyway
This commit is contained in:
Andrey Prygunkov
2021-04-15 01:26:36 +02:00
parent f8f9dd2b6d
commit 1ee8e02586

View File

@@ -117,6 +117,12 @@ void NzbFile::ParseSubject(FileInfo* fileInfo, bool TryQuotes)
{
// Example subject: some garbage "title" yEnc (10/99)
if (!fileInfo->GetSubject())
{
// Malformed file element without subject. We generate subject using internal element id.
fileInfo->SetSubject(CString::FormatStr("%d", fileInfo->GetId()));
}
// strip the "yEnc (10/99)"-suffix
BString<1024> subject = fileInfo->GetSubject();
char* end = subject + strlen(subject) - 1;