Add wgt package version policy 71/248371/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 26 Nov 2020 02:51:55 +0000 (11:51 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 30 Nov 2020 07:27:28 +0000 (16:27 +0900)
If given version string is not start with allowed pattern,
GetPackageVersion() will return empty string.
This patch will check its result and
fails entire install procedure if so.

Change-Id: I14ebc962f0dd7167b9d166a4844960744216fc9b
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/wgt/step/configuration/step_parse.cc

index 8c97c72..d4c677b 100644 (file)
@@ -249,7 +249,12 @@ bool StepParse::FillWidgetInfo(manifest_x* manifest) {
   const std::string& version = wgt_info->version();
 
   manifest->ns = strdup(kTizenPackageXmlNamespace);
-  manifest->version = strdup(GetPackageVersion(version).c_str());
+  std::string version_tmp = GetPackageVersion(version);
+  if (version_tmp.empty()) {
+    LOG(ERROR) << "Invalid version format : " << version;
+    return false;
+  }
+  manifest->version = strdup(version_tmp.c_str());
 
   for (auto& item : wgt_info->description_set()) {
     description_x* description = reinterpret_cast<description_x*>