Fix mxs_json_error usage
The function takes printf style arguments which means the format string must be a string constant.
This commit is contained in:
@ -218,7 +218,7 @@ json_t* mxs_json_error(const std::vector<std::string>& errors)
|
|||||||
|
|
||||||
for (it = std::next(it); it != errors.end(); ++it)
|
for (it = std::next(it); it != errors.end(); ++it)
|
||||||
{
|
{
|
||||||
rval = mxs_json_error_append(rval, it->c_str());
|
rval = mxs_json_error_append(rval, "%s", it->c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,14 +786,12 @@ HttpResponse cb_set_server(const HttpRequest& request)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return HttpResponse(MHD_HTTP_FORBIDDEN, mxs_json_error(errmsg.c_str()));
|
return HttpResponse(MHD_HTTP_FORBIDDEN, mxs_json_error("%s", errmsg.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HttpResponse(MHD_HTTP_FORBIDDEN,
|
return HttpResponse(MHD_HTTP_FORBIDDEN,
|
||||||
mxs_json_error("Invalid or missing value for the `%s` "
|
mxs_json_error("Invalid or missing value for the `%s` parameter", CN_STATE));
|
||||||
"parameter",
|
|
||||||
CN_STATE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse cb_clear_server(const HttpRequest& request)
|
HttpResponse cb_clear_server(const HttpRequest& request)
|
||||||
@ -810,14 +808,12 @@ HttpResponse cb_clear_server(const HttpRequest& request)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return HttpResponse(MHD_HTTP_FORBIDDEN, mxs_json_error(errmsg.c_str()));
|
return HttpResponse(MHD_HTTP_FORBIDDEN, mxs_json_error("%s", errmsg.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HttpResponse(MHD_HTTP_FORBIDDEN,
|
return HttpResponse(MHD_HTTP_FORBIDDEN,
|
||||||
mxs_json_error("Invalid or missing value for the `%s` "
|
mxs_json_error("Invalid or missing value for the `%s` parameter", CN_STATE));
|
||||||
"parameter",
|
|
||||||
CN_STATE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse cb_modulecmd(const HttpRequest& request)
|
HttpResponse cb_modulecmd(const HttpRequest& request)
|
||||||
|
Reference in New Issue
Block a user