Merge branch '2.2' into 2.3

This commit is contained in:
Markus Mäkelä
2019-05-28 14:17:43 +03:00
2 changed files with 14 additions and 7 deletions

View File

@ -143,6 +143,8 @@ char* maxavro_read_string(MAXAVRO_FILE* file, size_t* size)
uint64_t len; uint64_t len;
if (maxavro_read_integer(file, &len)) if (maxavro_read_integer(file, &len))
{
if (file->buffer_ptr + len < file->buffer_end)
{ {
key = MXS_MALLOC(len + 1); key = MXS_MALLOC(len + 1);
if (key) if (key)
@ -157,6 +159,11 @@ char* maxavro_read_string(MAXAVRO_FILE* file, size_t* size)
file->last_error = MAXAVRO_ERR_MEMORY; file->last_error = MAXAVRO_ERR_MEMORY;
} }
} }
else
{
file->last_error = MAXAVRO_ERR_MEMORY;
}
}
return key; return key;
} }

View File

@ -1120,7 +1120,7 @@ static bool token_is_keyword(const char* tok, int len)
{ {
for (int i = 0; keywords[i]; i++) for (int i = 0; keywords[i]; i++)
{ {
if (strncasecmp(keywords[i], tok, len) == 0) if (strncasecmp(keywords[i], tok, len) == 0 && strlen(keywords[i]) == len)
{ {
return true; return true;
} }