diff --git a/server/core/config.c b/server/core/config.c index 00fdef292..f5d63ee7b 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -318,14 +318,14 @@ int rval, ini_rval; { char errorbuffer[1024 + 1]; - if(ini_rval > 0) - snprintf(errorbuffer, 1024, + if (ini_rval > 0) + snprintf(errorbuffer, sizeof(errorbuffer), "Error: Failed to parse configuration file. Error on line %d.", ini_rval); else if(ini_rval == -1) - snprintf(errorbuffer, 1024, + snprintf(errorbuffer, sizeof(errorbuffer), "Error: Failed to parse configuration file. Failed to open file."); else - snprintf(errorbuffer, 1024, + snprintf(errorbuffer, sizeof(errorbuffer), "Error: Failed to parse configuration file. Memory allocation failed."); skygw_log_write(LE, errorbuffer); diff --git a/server/core/gateway.c b/server/core/gateway.c index 85662e167..99a654939 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -1594,16 +1594,16 @@ int main(int argc, char **argv) if((ini_rval = ini_parse(cnf_file_path, cnf_preparser,NULL)) != 0) { - char errorbuffer[STRING_BUFFER_SIZE + 1]; + char errorbuffer[STRING_BUFFER_SIZE]; if(ini_rval > 0) - snprintf(errorbuffer, STRING_BUFFER_SIZE, + snprintf(errorbuffer, sizeof(errorbuffer), "Error: Failed to pre-parse configuration file. Error on line %d.", ini_rval); else if(ini_rval == -1) - snprintf(errorbuffer, STRING_BUFFER_SIZE, + snprintf(errorbuffer, sizeof(errorbuffer), "Error: Failed to pre-parse configuration file. Failed to open file."); else - snprintf(errorbuffer, STRING_BUFFER_SIZE, + snprintf(errorbuffer, sizeof(errorbuffer), "Error: Failed to pre-parse configuration file. Memory allocation failed."); skygw_log_write(LE, errorbuffer);