Fixes to Coverity defects 84335 84336 84337

This commit is contained in:
Markus Makela
2014-12-04 10:13:41 +02:00
parent 30c928c326
commit 84679a48ff
3 changed files with 7 additions and 7 deletions

View File

@ -231,9 +231,9 @@ int set_and_get_mysql_users_wildcards(char *username, char *hostname, char *pass
service->users = mysql_users;
if (db_from != NULL)
strncpy(data->db, db_from,MYSQL_DATABASE_MAXLEN+1);
strncpy(data->db, db_from,MYSQL_DATABASE_MAXLEN);
else
strncpy(data->db, "",MYSQL_DATABASE_MAXLEN+1);
strncpy(data->db, "",MYSQL_DATABASE_MAXLEN);
/* freed by dcb_free(dcb) */
dcb->data = data;

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;
strncpy(username, (char *)client_auth_packet,MYSQL_USER_MAXLEN+1);
strncpy(username, (char *)client_auth_packet,MYSQL_USER_MAXLEN);
client_auth_packet += strlen(username) + 1;
/* get the auth token len */
@ -1350,7 +1350,7 @@ static int gw_change_user(
}
/* get new database name */
strncpy(database, (char *)client_auth_packet,MYSQL_DATABASE_MAXLEN+1);
strncpy(database, (char *)client_auth_packet,MYSQL_DATABASE_MAXLEN);
/* 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 */
strncpy(current_database, current_session->db,MYSQL_DATABASE_MAXLEN+1);
strncpy(current_database, current_session->db,MYSQL_DATABASE_MAXLEN);
/*
* Now clear database name in dcb as we don't do local authentication on db name for change user.