#include <exception/Exception.h>
#include <translator/Translator.h>
#include <config/Path.h>
+#include <config/Limits.h>
#include <security-manager.h>
break;
}
+ Limits::checkSizeLimit(size);
+
buf = new char[size];
if (!Socket::recv(sockfd, buf, size)) {
m_popupData = new PopupData({NResponseType::Deny, nullptr});
}
+GuiRunner::~GuiRunner()
+{
+ delete m_popupData;
+}
+
void GuiRunner::initialize()
{
elm_init(0, NULL);
class GuiRunner {
public:
GuiRunner();
+ ~GuiRunner();
NResponseType popupRun(const std::string &app, const std::string &perm);
${COMMON_PATH}/translator/Translator.cpp
${COMMON_PATH}/types/AgentErrorMsg.cpp
${COMMON_PATH}/util/SafeFunction.cpp
+ ${COMMON_PATH}/config/Limits.cpp
${COMMON_PATH}/config/Path.cpp
)
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/common/config/Limits.cpp
+ * @author Oskar Świtalski <o.switalski@samsung.com>
+ * @brief Definition of limits methods
+ */
+
+
+#include "Limits.h"
+
+#include <string>
+#include <exception/Exception.h>
+
+namespace AskUser {
+namespace Limits {
+
+namespace {
+
+constexpr size_t sizeLimit = 8192;
+
+}
+
+void checkSizeLimit(size_t size) {
+ if (size > sizeLimit)
+ throw Exception("Size exceeds limits; limit: " +
+ std::to_string(sizeLimit) +
+ " size: " + std::to_string(size));
+}
+
+} // namespace Limits
+} // namespace AskUser
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/common/config/Limits.h
+ * @author Oskar Świtalski <o.switalski@samsung.com>
+ * @brief Declaration of limits methods
+ */
+
+#pragma once
+
+#include <cstddef>
+
+namespace AskUser {
+namespace Limits {
+
+void checkSizeLimit(size_t size);
+
+} // namespace Limits
+} // namespace AskUser