GHSL-2023-112: check if the current pointer and the next one are less than the end

This commit is contained in:
jarlob 2023-07-01 21:44:47 +02:00 committed by JarLob
parent 02dd1d36fc
commit 5687c4f43c
2 changed files with 2 additions and 2 deletions

View File

@ -152,7 +152,7 @@ size_t Utf8_16_Read::convert(char* buf, size_t len)
case uni16LE_NoBOM:
case uni16BE:
case uni16LE: {
size_t newSize = len + len / 2 + 1;
size_t newSize = (len + len % 2) + (len + len % 2) / 2;
if (m_nAllocatedBufSize != newSize)
{

View File

@ -53,7 +53,7 @@ public:
bool get(utf8 *c);
void operator++();
eState getState() { return m_eState; };
operator bool() { return (m_pRead < m_pEnd) || (m_out1st != m_outLst); };
operator bool() { return (m_pRead + 1 < m_pEnd) || (m_out1st != m_outLst); };
protected:
void read();