Restrict rule name length during rule creation
@@ -439,6 +439,13 @@ int DeRestPluginPrivate::createRule(const ApiRequest &req, ApiResponse &rsp)
if ((map["name"].type() == QVariant::String) && !name.isEmpty())
{
+ if (name.size() > MAX_RULE_NAME_LENGTH)
+ {
+ rsp.list.append(errorToMap(ERR_MISSING_PARAMETER, QString("/rules/name"), QString("invalid/missing parameters in body")));
+ rsp.httpStatus = HttpStatusBadRequest;
+ return REQ_READY_SEND;
+ }
+
QVariantMap rspItem;
QVariantMap rspItemState;
