Fix buffer overrun

This commit is contained in:
rfm 2025-02-18 17:32:45 +00:00
parent 9f90bdc755
commit db1ff663f6

View file

@ -3256,6 +3256,7 @@ static int poolConnections = 0;
unsigned char *buf;
unsigned char *ptr;
const unsigned char *from = (const unsigned char*)statement;
const unsigned char *end = from + strlen((const char*)statement);
/*
* Calculate length of buffer needed.
@ -3274,10 +3275,10 @@ static int poolConnections = 0;
* Merge quoted data objects into statement.
*/
i = 1;
from = (unsigned char*)statement;
while (*from != 0)
while (from < end)
{
if (*from == *(unsigned char*)marker
&& (from + mLength) < end
&& memcmp(from, marker, mLength) == 0)
{
NSData *d = [blobs objectAtIndex: i++];