From 0e2ea2fa6c8bd4ba16c8482e3ded7a434d2f510f Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Mon, 13 Apr 2020 16:01:47 +0200 Subject: [PATCH] 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. --- src/ZNCString.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ZNCString.cpp b/src/ZNCString.cpp index 6eb762f1..1162e1c5 100644 --- a/src/ZNCString.cpp +++ b/src/ZNCString.cpp @@ -294,13 +294,13 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const { } if (ch == 0) { - if (!strncasecmp((const char*)&pTmp, "<", 2)) + if (!strncasecmp((const char*)&pTmp, "<", 4)) ch = '<'; - else if (!strncasecmp((const char*)&pTmp, ">", 2)) + else if (!strncasecmp((const char*)&pTmp, ">", 4)) ch = '>'; - else if (!strncasecmp((const char*)&pTmp, """, 4)) + else if (!strncasecmp((const char*)&pTmp, """, 6)) ch = '"'; - else if (!strncasecmp((const char*)&pTmp, "&", 3)) + else if (!strncasecmp((const char*)&pTmp, "&", 5)) ch = '&'; }