diff --git a/services/bundlemgr_lite/src/bundle_parser.cpp b/services/bundlemgr_lite/src/bundle_parser.cpp index 530b7744930ae2877bc8daad8eeed5f7234874d6..de1c6d1d9988a200f5627f76791e4278a53bbd4f 100755 --- a/services/bundlemgr_lite/src/bundle_parser.cpp +++ b/services/bundlemgr_lite/src/bundle_parser.cpp @@ -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;