Fixed Coverity defects

This commit is contained in:
Markus Makela
2015-07-14 16:17:50 +03:00
parent aa92b31ef1
commit 3992f262ca
7 changed files with 37 additions and 28 deletions

View File

@ -671,7 +671,7 @@ blr_cache_response(ROUTER_INSTANCE *router, char *response, GWBUF *buf)
char path[PATH_MAX+1], *ptr;
int fd;
strcpy(path,get_datadir());
strncpy(path,get_datadir(),PATH_MAX);
strncat(path,"/",PATH_MAX);
strncat(path, router->service->name, PATH_MAX);
@ -706,7 +706,7 @@ char path[PATH_MAX+1], *ptr;
int fd;
GWBUF *buf;
strcpy(path, get_datadir());
strncpy(path, get_datadir(),PATH_MAX);
strncat(path, "/", PATH_MAX);
strncat(path, router->service->name, PATH_MAX);
strncat(path, "/.cache/", PATH_MAX);

View File

@ -1249,8 +1249,8 @@ MYSQL_session *auth_info;
if ((auth_info = calloc(1, sizeof(MYSQL_session))) == NULL)
return NULL;
strncpy(auth_info->user, username,MYSQL_USER_MAXLEN+1);
strncpy(auth_info->db, database,MYSQL_DATABASE_MAXLEN+1);
strncpy(auth_info->user, username,MYSQL_USER_MAXLEN);
strncpy(auth_info->db, database,MYSQL_DATABASE_MAXLEN);
gw_sha1_str((const uint8_t *)password, strlen(password), auth_info->client_sha1);
return auth_info;