Add format checks for printf-style functions
Added format checks to functions that expect printf style arguments and fixed any broken calls to these functions.
This commit is contained in:
@ -42,6 +42,9 @@ static SPINLOCK crt_lock = SPINLOCK_INIT;
|
||||
#define RUNTIME_ERRMSG_BUFSIZE 512
|
||||
thread_local char runtime_errmsg[RUNTIME_ERRMSG_BUFSIZE];
|
||||
|
||||
/** Attributes need to be in the declaration */
|
||||
static void runtime_error(const char* fmt, ...) mxs_attribute((format (printf, 1, 2)));
|
||||
|
||||
static void runtime_error(const char* fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
@ -1166,7 +1169,8 @@ static bool validate_ssl_json(json_t* params)
|
||||
!mxs_json_pointer(params, CN_SSL_CERT) ||
|
||||
!mxs_json_pointer(params, CN_SSL_CA_CERT))
|
||||
{
|
||||
runtime_error("SSL configuration requires '%s', '%s' and '%s' parameters");
|
||||
runtime_error("SSL configuration requires '%s', '%s' and '%s' parameters",
|
||||
CN_SSL_KEY, CN_SSL_CERT, CN_SSL_CA_CERT);
|
||||
rval = false;
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ MODULECMD_ARG* modulecmd_arg_parse(const MODULECMD *cmd, int argc, const void **
|
||||
if (!process_argument(cmd, &cmd->arg_types[i], argv[i], &arg->argv[i], &err))
|
||||
{
|
||||
error = true;
|
||||
modulecmd_set_error("Argument %d, %s: %s", i + 1, err, argv[i] ? argv[i] : "No argument given");
|
||||
modulecmd_set_error("Argument %d, %s: %s", i + 1, err, argv[i] ? (char*)argv[i] : "No argument given");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user