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:
Markus Mäkelä
2019-03-22 12:52:56 +02:00
parent c57682291f
commit 75c6ef2dc8
2 changed files with 5 additions and 9 deletions

View File

@ -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());
} }
} }

View File

@ -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)