Fixes to Coverity defects 85010 84878 72752 72742 72719 and 73418.
skygw_utils.cc: Added function is_valid_posix_path that checks if a path is POSIX-compliant.
This commit is contained in:
@ -140,7 +140,6 @@ int modutil_MySQL_query_len(
|
||||
{
|
||||
int len;
|
||||
int buflen;
|
||||
uint8_t data;
|
||||
|
||||
if (!modutil_is_SQL(buf))
|
||||
{
|
||||
@ -287,7 +286,7 @@ modutil_get_query(GWBUF *buf)
|
||||
|
||||
case MYSQL_COM_QUERY:
|
||||
len = MYSQL_GET_PACKET_LEN(packet)-1; /*< distract 1 for packet type byte */
|
||||
if (len < 1 || (query_str = (char *)malloc(len+1)) == NULL)
|
||||
if (len < 1 || len > SIZE_MAX - 1 || (query_str = (char *)malloc(len+1)) == NULL)
|
||||
{
|
||||
goto retblock;
|
||||
}
|
||||
@ -297,7 +296,7 @@ modutil_get_query(GWBUF *buf)
|
||||
|
||||
default:
|
||||
len = strlen(STRPACKETTYPE(packet_type))+1;
|
||||
if (len < 1 || (query_str = (char *)malloc(len+1)) == NULL)
|
||||
if (len < 1 || len > SIZE_MAX - 1 || (query_str = (char *)malloc(len+1)) == NULL)
|
||||
{
|
||||
goto retblock;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user