Fixes to Coverity defects.
This commit is contained in:
parent
e937947f01
commit
fbedad84af
@ -2138,7 +2138,7 @@ config_get_release_string(char* release)
|
||||
*end = 0;
|
||||
|
||||
to = strcpy(distribution, "lsb: ");
|
||||
memmove(to, found, end - found + 1);
|
||||
memmove(to, found, end - found + 1 < INT_MAX ? end - found + 1 : INT_MAX);
|
||||
|
||||
strncpy(release, to, _RELEASE_STR_LENGTH);
|
||||
|
||||
@ -2175,7 +2175,7 @@ config_get_release_string(char* release)
|
||||
+5 and -8 below cut the file name part out of the
|
||||
full pathname that corresponds to the mask as above.
|
||||
*/
|
||||
new_to = strcpy(distribution, found.gl_pathv[0] + 5);
|
||||
new_to = strncpy(distribution, found.gl_pathv[0] + 5,_RELEASE_STR_LENGTH - 1);
|
||||
new_to += 8;
|
||||
*new_to++ = ':';
|
||||
*new_to++ = ' ';
|
||||
|
@ -798,7 +798,7 @@ getUsers(SERVICE *service, USERS *users)
|
||||
if (db_grants) {
|
||||
/* we have dbgrants, store them */
|
||||
if(row[5]){
|
||||
strcpy(dbnm,row[5]);
|
||||
strncpy(dbnm,row[5],MYSQL_DATABASE_MAXLEN);
|
||||
if(service->strip_db_esc) {
|
||||
strip_escape_chars(dbnm);
|
||||
}
|
||||
|
@ -690,6 +690,8 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
|
||||
time_t now;
|
||||
struct tm *now_tm;
|
||||
int report_max_bytes=0;
|
||||
if(buffer == NULL)
|
||||
return 0;
|
||||
|
||||
now = time(NULL);
|
||||
|
||||
@ -838,13 +840,13 @@ do_http_post(GWBUF *buffer, void *cfg) {
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK) {
|
||||
ret_code = 2;
|
||||
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: do_http_post(), curl call for [%s] failed due: %s, %s",
|
||||
feedback_config->feedback_url,
|
||||
curl_easy_strerror(res),
|
||||
error_message)));
|
||||
goto cleanup;
|
||||
} else {
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
|
||||
}
|
||||
@ -855,6 +857,7 @@ do_http_post(GWBUF *buffer, void *cfg) {
|
||||
ret_code = 0;
|
||||
} else {
|
||||
ret_code = 3;
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
@ -862,18 +865,21 @@ do_http_post(GWBUF *buffer, void *cfg) {
|
||||
"Error: do_http_post(), Bad HTTP Code from remote server: %lu",
|
||||
http_code)));
|
||||
ret_code = 4;
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: do_http_post(), curl object not initialized")));
|
||||
ret_code = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
LOGIF(LT, (skygw_log_write_flush(
|
||||
LOGFILE_TRACE,
|
||||
"do_http_post() ret_code [%d], HTTP code [%d]",
|
||||
ret_code, http_code)));
|
||||
cleanup:
|
||||
|
||||
if (chunk.data)
|
||||
free(chunk.data);
|
||||
|
@ -126,7 +126,7 @@ MAXINFO_TREE *col, *table;
|
||||
|
||||
/**
|
||||
* Parse a column list, may be a * or a valid list of string name
|
||||
* seperated by a comma
|
||||
* separated by a comma
|
||||
*
|
||||
* @param sql Pointer to pointer to column list updated to point to the table name
|
||||
* @return A tree of column names
|
||||
@ -148,9 +148,11 @@ MAXINFO_TREE * rval = NULL;
|
||||
case LT_COMMA:
|
||||
rval = make_tree_node(MAXOP_COLUMNS, text, NULL,
|
||||
parse_column_list(ptr));
|
||||
break;
|
||||
case LT_FROM:
|
||||
rval = make_tree_node(MAXOP_COLUMNS, text, NULL,
|
||||
NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1632,7 +1632,7 @@ gen_show_dbs_response(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client)
|
||||
rval = gwbuf_append(rval, last_packet);
|
||||
|
||||
rval = gwbuf_make_contiguous(rval);
|
||||
|
||||
hashtable_iterator_free(iter);
|
||||
return rval;
|
||||
}
|
||||
|
||||
@ -2224,19 +2224,20 @@ static void clientReply (
|
||||
goto lock_failed;
|
||||
}
|
||||
bref = get_bref_from_dcb(router_cli_ses, backend_dcb);
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Received reply from %s for session %p",
|
||||
bref->bref_backend->backend_server->unique_name,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
#if !defined(FOR_BUG548_FIX_ONLY)
|
||||
/** This makes the issue becoming visible in poll.c */
|
||||
|
||||
if (bref == NULL)
|
||||
{
|
||||
/** Unlock router session */
|
||||
rses_end_locked_router_action(router_cli_ses);
|
||||
goto lock_failed;
|
||||
}
|
||||
#endif
|
||||
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Received reply from %s for session %p",
|
||||
bref->bref_backend->backend_server->unique_name,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
|
||||
|
||||
|
||||
if(router_cli_ses->init & INIT_MAPPING)
|
||||
{
|
||||
bool mapped = true, logged = false;
|
||||
@ -3905,7 +3906,7 @@ static bool handle_error_new_connection(
|
||||
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Re-mapping databases");
|
||||
gen_databaselist(rses->router,rses);
|
||||
|
||||
hashtable_iterator_free(iter);
|
||||
return_succp:
|
||||
return succp;
|
||||
}
|
||||
|
@ -274,7 +274,8 @@ char* get_lenenc_str(void* data, int* len)
|
||||
|
||||
if(data == NULL || len == NULL)
|
||||
{
|
||||
*len = -1;
|
||||
if(len)
|
||||
*len = -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1099,7 +1100,8 @@ return_rses:
|
||||
}
|
||||
#endif
|
||||
errorblock:
|
||||
if(client_rses->subservice)
|
||||
|
||||
if(client_rses && client_rses->subservice)
|
||||
{
|
||||
for(j = 0; j < i; j++)
|
||||
{
|
||||
@ -1661,14 +1663,7 @@ routeQuery(ROUTER* instance,
|
||||
|
||||
ret = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/** Something else went wrong, terminate connection */
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
goto retblock;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -2794,6 +2789,9 @@ get_shard_subsvc(SUBSERVICE** subsvc,ROUTER_CLIENT_SES* session,char* target)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(subsvc == NULL || session == NULL || target == NULL)
|
||||
return false;
|
||||
|
||||
for(i = 0;i<session->n_subservice;i++)
|
||||
{
|
||||
if(strcmp(session->subservice[i]->service->name,target) == 0)
|
||||
@ -2859,7 +2857,7 @@ router_handle_state_switch(
|
||||
CHK_DCB(dcb);
|
||||
|
||||
return rc;
|
||||
|
||||
#if 0
|
||||
if(SERVER_IS_RUNNING(srv) && SERVER_IS_IN_CLUSTER(srv))
|
||||
{
|
||||
goto return_rc;
|
||||
@ -2882,6 +2880,7 @@ router_handle_state_switch(
|
||||
|
||||
return_rc:
|
||||
return rc;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,7 @@ int main(int argc, char** argv)
|
||||
goto report;
|
||||
}
|
||||
|
||||
sprintf(query,"STOP SLAVE",databases[i]);
|
||||
sprintf(query,"STOP SLAVE");
|
||||
if(mysql_real_query(server,query,strlen(query)))
|
||||
{
|
||||
fprintf(stderr, "Failed to stop slave in %d: %s.\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user