Fixes to Coverity defects 83027 73421 72714 72671 72646 72642

This commit is contained in:
Markus Makela
2014-12-03 17:56:22 +02:00
parent 89c3b01925
commit 1e2027f4dc
6 changed files with 11 additions and 11 deletions

View File

@ -177,7 +177,7 @@ HTTPD_session *client_data = NULL;
j++;
}
while (!ISspace(buf[j]) && (i < sizeof(url) - 1) && (j < sizeof(buf) - 1)) {
while ((j < sizeof(buf) - 1) && !ISspace(buf[j]) && (i < sizeof(url) - 1)) {
url[i] = buf[j];
i++; j++;
}

View File

@ -1329,7 +1329,7 @@ static int gw_change_user(
/* now get the user, after 4 bytes header and 1 byte command */
client_auth_packet += 5;
strcpy(username, (char *)client_auth_packet);
strncpy(username, (char *)client_auth_packet,MYSQL_USER_MAXLEN+1);
client_auth_packet += strlen(username) + 1;
/* get the auth token len */
@ -1350,7 +1350,7 @@ static int gw_change_user(
}
/* get new database name */
strcpy(database, (char *)client_auth_packet);
strncpy(database, (char *)client_auth_packet,MYSQL_DATABASE_MAXLEN+1);
/* get character set */
if (strlen(database)) {
@ -1363,7 +1363,7 @@ static int gw_change_user(
memcpy(&backend_protocol->charset, client_auth_packet, sizeof(int));
/* save current_database name */
strcpy(current_database, current_session->db);
strncpy(current_database, current_session->db,MYSQL_DATABASE_MAXLEN+1);
/*
* Now clear database name in dcb as we don't do local authentication on db name for change user.

View File

@ -969,7 +969,7 @@ GWBUF* mysql_create_custom_error(
const char* msg)
{
uint8_t* outbuf = NULL;
uint8_t mysql_payload_size = 0;
uint32_t mysql_payload_size = 0;
uint8_t mysql_packet_header[4];
uint8_t* mysql_payload = NULL;
uint8_t field_count = 0;
@ -1579,7 +1579,7 @@ mysql_send_auth_error (
const char *mysql_message)
{
uint8_t *outbuf = NULL;
uint8_t mysql_payload_size = 0;
uint32_t mysql_payload_size = 0;
uint8_t mysql_packet_header[4];
uint8_t *mysql_payload = NULL;
uint8_t field_count = 0;