TDEMarkdown: Ensure that the loaded file content and generated HTML

are terminated by zero terminator to avoid reading overflow.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/159/head
Slávek Banko 2 years ago
parent 75252717c0
commit 0b365bf245
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -73,6 +73,11 @@ bool MarkdownPart::openURL(const KURL& u)
if(!data.isNull())
{
if (data[data.size()-1] != '\0')
{
data.resize(data.size()+1);
data[data.size()-1] = '\0';
}
begin(u);
TQString parsed(parse((MD_CHAR*) data.data()));
write(parsed);
@ -109,6 +114,11 @@ TQString& MarkdownPart::parse(MD_CHAR* document)
}
else
{
if (data[data.size()-1] != '\0')
{
data.resize(data.size()+1);
data[data.size()-1] = '\0';
}
m_buffer += TQString::fromLocal8Bit(data);
}

Loading…
Cancel
Save