Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA
This commit is contained in:
@ -1776,11 +1776,12 @@ static bool dcb_set_state_nomutex(
|
||||
* @param dcb The DCB to write buffer
|
||||
* @param buf Buffer to write
|
||||
* @param nbytes Number of bytes to write
|
||||
* @return Number of written bytes
|
||||
*/
|
||||
int
|
||||
gw_write(DCB *dcb, const void *buf, size_t nbytes)
|
||||
{
|
||||
int w;
|
||||
int w = 0;
|
||||
int fd = dcb->fd;
|
||||
#if defined(FAKE_CODE)
|
||||
if (fd > 0 && dcb_fake_write_errno[fd] != 0)
|
||||
|
||||
@ -234,7 +234,7 @@ modutil_get_query(GWBUF *buf)
|
||||
uint8_t* packet;
|
||||
mysql_server_cmd_t packet_type;
|
||||
size_t len;
|
||||
char* query_str;
|
||||
char* query_str = NULL;
|
||||
|
||||
packet = GWBUF_DATA(buf);
|
||||
packet_type = packet[4];
|
||||
@ -252,7 +252,7 @@ modutil_get_query(GWBUF *buf)
|
||||
|
||||
case MYSQL_COM_QUERY:
|
||||
len = MYSQL_GET_PACKET_LEN(packet)-1; /*< distract 1 for packet type byte */
|
||||
if ((query_str = (char *)malloc(len+1)) == NULL)
|
||||
if (len < 1 || (query_str = (char *)malloc(len+1)) == NULL)
|
||||
{
|
||||
goto retblock;
|
||||
}
|
||||
@ -262,7 +262,7 @@ modutil_get_query(GWBUF *buf)
|
||||
|
||||
default:
|
||||
len = strlen(STRPACKETTYPE(packet_type))+1;
|
||||
if ((query_str = (char *)malloc(len+1)) == NULL)
|
||||
if (len < 1 || (query_str = (char *)malloc(len+1)) == NULL)
|
||||
{
|
||||
goto retblock;
|
||||
}
|
||||
|
||||
@ -3812,7 +3812,8 @@ static bool execute_sescmd_in_backend(
|
||||
tmpbuf = scur->scmd_cur_cmd->my_sescmd_buf;
|
||||
qlen = MYSQL_GET_PACKET_LEN((unsigned char*)tmpbuf->start);
|
||||
memset(data->db,0,MYSQL_DATABASE_MAXLEN+1);
|
||||
strncpy(data->db,tmpbuf->start+5,qlen - 1);
|
||||
if(qlen > 0)
|
||||
strncpy(data->db,tmpbuf->start+5,qlen - 1);
|
||||
}
|
||||
/** Fallthrough */
|
||||
case MYSQL_COM_QUERY:
|
||||
|
||||
Reference in New Issue
Block a user