Fixed to Coverity defects and a fix to tee filter not compiling with SS_DEBUG flag.
This commit is contained in:
@ -82,7 +82,7 @@ struct dirent *dp;
|
||||
strcpy(path, "/usr/local/skysql/MaxScale");
|
||||
if ((ptr = getenv("MAXSCALE_HOME")) != NULL)
|
||||
{
|
||||
strcpy(path, ptr);
|
||||
strncpy(path, ptr,PATH_MAX);
|
||||
}
|
||||
strcat(path, "/");
|
||||
strcat(path, router->service->name);
|
||||
@ -196,7 +196,7 @@ unsigned char magic[] = BINLOG_MAGIC;
|
||||
fsync(fd);
|
||||
close(router->binlog_fd);
|
||||
spinlock_acquire(&router->binlog_lock);
|
||||
strcpy(router->binlog_name, file);
|
||||
strncpy(router->binlog_name, file,BINLOG_FNAMELEN+1);
|
||||
router->binlog_position = 4; /* Initial position after the magic number */
|
||||
spinlock_release(&router->binlog_lock);
|
||||
router->binlog_fd = fd;
|
||||
@ -230,7 +230,7 @@ int fd;
|
||||
fsync(fd);
|
||||
close(router->binlog_fd);
|
||||
spinlock_acquire(&router->binlog_lock);
|
||||
strcpy(router->binlog_name, file);
|
||||
strncpy(router->binlog_name, file,BINLOG_FNAMELEN+1);
|
||||
router->binlog_position = lseek(fd, 0L, SEEK_END);
|
||||
spinlock_release(&router->binlog_lock);
|
||||
router->binlog_fd = fd;
|
||||
@ -310,7 +310,7 @@ BLFILE *file;
|
||||
spinlock_release(&router->fileslock);
|
||||
return NULL;
|
||||
}
|
||||
strcpy(file->binlogname, binlog);
|
||||
strncpy(file->binlogname, binlog,BINLOG_FNAMELEN+1);
|
||||
file->refcnt = 1;
|
||||
file->cache = 0;
|
||||
spinlock_init(&file->lock);
|
||||
|
@ -1228,8 +1228,8 @@ MYSQL_session *auth_info;
|
||||
|
||||
if ((auth_info = calloc(1, sizeof(MYSQL_session))) == NULL)
|
||||
return NULL;
|
||||
strcpy(auth_info->user, username);
|
||||
strcpy(auth_info->db, database);
|
||||
strncpy(auth_info->user, username,MYSQL_USER_MAXLEN+1);
|
||||
strncpy(auth_info->db, database,MYSQL_DATABASE_MAXLEN+1);
|
||||
gw_sha1_str((const uint8_t *)password, strlen(password), auth_info->client_sha1);
|
||||
|
||||
return auth_info;
|
||||
|
@ -385,7 +385,9 @@ char *sql;
|
||||
if (modutil_MySQL_Query(queue, &sql, &len, &residual))
|
||||
{
|
||||
sql = strndup(sql, len);
|
||||
return maxinfo_execute_query(instance, session, sql);
|
||||
int rc = maxinfo_execute_query(instance, session, sql);
|
||||
free(sql);
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -85,6 +85,7 @@ int len;
|
||||
return;
|
||||
sprintf(msg, "%s in query '%s'", desc, sql);
|
||||
maxinfo_send_error(dcb, 1149, msg);
|
||||
free(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -112,7 +113,7 @@ int len;
|
||||
data[4] = 0xff; // Error indicator
|
||||
data[5] = errcode & 0xff; // Error Code
|
||||
data[6] = (errcode >> 8) & 0xff; // Error Code
|
||||
strncpy((char *)&data[7], "#42000", 6);
|
||||
strncpy((char *)&data[13], msg, strlen(msg)); // Error Message
|
||||
memcpy(&data[7], "#42000", 6);
|
||||
memcpy(&data[13], msg, strlen(msg)); // Error Message
|
||||
dcb->func.write(dcb, pkt);
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ exec_select(DCB *dcb, MAXINFO_TREE *tree)
|
||||
static int
|
||||
maxinfo_pattern_match(char *pattern, char *str)
|
||||
{
|
||||
int anchor, len, trailing;
|
||||
int anchor = 0, len, trailing;
|
||||
char *fixed;
|
||||
extern char *strcasestr();
|
||||
|
||||
|
@ -100,6 +100,7 @@ MAXINFO_TREE *col, *table;
|
||||
}
|
||||
}
|
||||
// Malformed show
|
||||
free(text);
|
||||
free_tree(tree);
|
||||
*parse_error = PARSE_MALFORMED_SHOW;
|
||||
return NULL;
|
||||
@ -151,6 +152,8 @@ MAXINFO_TREE *tree = NULL;
|
||||
case LT_FROM:
|
||||
return make_tree_node(MAXOP_COLUMNS, text, NULL,
|
||||
NULL);
|
||||
default:
|
||||
free(text);
|
||||
}
|
||||
break;
|
||||
case LT_STAR:
|
||||
@ -159,6 +162,8 @@ MAXINFO_TREE *tree = NULL;
|
||||
if (lookahead != LT_FROM)
|
||||
return make_tree_node(MAXOP_ALL_COLUMNS, NULL, NULL,
|
||||
NULL);
|
||||
default:
|
||||
free(text2);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -180,6 +185,7 @@ MAXINFO_TREE *tree = NULL;
|
||||
*ptr = fetch_token(*ptr, &token, &text);
|
||||
if (token == LT_STRING)
|
||||
return make_tree_node(MAXOP_TABLE, text, NULL, NULL);
|
||||
free(text);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user