mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-18 17:54:39 -04:00
fix nullptr problem
Signed-off-by: shilei <shilei91@huawei.com> Change-Id: I85eae5154b973673bf4e820db627e5bab03a69d6
This commit is contained in:
@@ -711,8 +711,9 @@ uint8_t BundleParser::ParseAbilityDeviceCap(const cJSON *abilityObjectItem, Abil
|
||||
continue;
|
||||
}
|
||||
deviceCapName = abilityInfo.deviceCap.systemCapName + index;
|
||||
if (strncpy_s(deviceCapName->name, sizeof(deviceCapName->name),
|
||||
deviceCapObject->valuestring, strlen(deviceCapObject->valuestring)) != EOK) {
|
||||
if ((deviceCapObject->valuestring != nullptr) &&
|
||||
(strncpy_s(deviceCapName->name, sizeof(deviceCapName->name),
|
||||
deviceCapObject->valuestring, strlen(deviceCapObject->valuestring)) != EOK)) {
|
||||
HILOG_ERROR(HILOG_MODULE_APP, "ParseAbilityDeviceCap strncpy deviceCap fail!");
|
||||
AdapterFree(abilityInfo.deviceCap.systemCapName);
|
||||
abilityInfo.deviceCap.systemCapNum = 0;
|
||||
|
||||
Reference in New Issue
Block a user