From: Hwankyu Jhun Date: Thu, 21 Sep 2023 04:18:05 +0000 (+0900) Subject: Modify argv creation of liblaunchpad library X-Git-Tag: accepted/tizen/unified/20230923.084308~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91ee737e41fe6ab22f2fe1c86c7cce0c005d05fa;p=platform%2Fcore%2Fappfw%2Flaunchpad.git Modify argv creation of liblaunchpad library The last element of the argv should be nullptr. If the last element is not nullptr, the following error can be occurred: "Failed to execute a file. path: , errno: 14(Bad address)" Change-Id: I5d691492171caf2e8a33ca72e874de6d609cabfb Signed-off-by: Hwankyu Jhun --- diff --git a/src/lib/launchpad/launchpad_loader.cc b/src/lib/launchpad/launchpad_loader.cc index bfb301b4..fdf50fd9 100644 --- a/src/lib/launchpad/launchpad_loader.cc +++ b/src/lib/launchpad/launchpad_loader.cc @@ -328,14 +328,14 @@ void LaunchpadLoader::ProcessLaunchRequest(tizen_base::Parcel* parcel) { Util::SetEnvironments(&app_info_); auto exported_args = app_info_.GetBundle().Export(); exported_args[0] = app_info_.GetAppPath(); - app_argc_ = exported_args.size(); + app_argc_ = exported_args.size() + 1; app_argv_ = static_cast(calloc(app_argc_, sizeof(char*))); if (app_argv_ == nullptr) { _E("calloc() is failed"); exit(-ENOMEM); } - for (int i = 0; i < app_argc_; ++i) { + for (int i = 0; i < app_argc_ - 1; ++i) { app_argv_[i] = strdup(exported_args[i].c_str()); if (app_argv_[i] == nullptr) { _E("strdup() is failed. [%d] %s", i, exported_args[i].c_str());