Fix incorrect html entities parsing in ZNCString.cpp

This PR fixes wrong size argument passed to `strncasecmp` function when it was invoked to check if the string contains HTML entities.
This commit is contained in:
Disconnect3d
2020-04-13 16:01:47 +02:00
committed by GitHub
parent 972e9adb29
commit 0e2ea2fa6c
+4 -4
View File
@@ -294,13 +294,13 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
} }
if (ch == 0) { if (ch == 0) {
if (!strncasecmp((const char*)&pTmp, "<", 2)) if (!strncasecmp((const char*)&pTmp, "<", 4))
ch = '<'; ch = '<';
else if (!strncasecmp((const char*)&pTmp, "&gt;", 2)) else if (!strncasecmp((const char*)&pTmp, "&gt;", 4))
ch = '>'; ch = '>';
else if (!strncasecmp((const char*)&pTmp, "&quot;", 4)) else if (!strncasecmp((const char*)&pTmp, "&quot;", 6))
ch = '"'; ch = '"';
else if (!strncasecmp((const char*)&pTmp, "&amp;", 3)) else if (!strncasecmp((const char*)&pTmp, "&amp;", 5))
ch = '&'; ch = '&';
} }