mirror of https://github.com/citusdata/citus.git
Validate input string length
parent
c7af2ff0ef
commit
0de2ebad3f
|
@ -585,8 +585,13 @@ MultiTenantMonitorshmemSize(void)
|
|||
static char *
|
||||
extractTopComment(const char *inputString)
|
||||
{
|
||||
int i = 0;
|
||||
int commentStartCharsLength = 2;
|
||||
if (strlen(inputString) < commentStartCharsLength )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
/* If query starts with a comment */
|
||||
if (inputString[i] == '/' && inputString[i + 1] == '*')
|
||||
{
|
||||
|
@ -598,9 +603,9 @@ extractTopComment(const char *inputString)
|
|||
}
|
||||
}
|
||||
|
||||
if (i > 2)
|
||||
if (i > commentStartCharsLength)
|
||||
{
|
||||
return get_substring(inputString, 2, i);
|
||||
return get_substring(inputString, commentStartCharsLength, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue