diff --git a/services/bundlemgr_lite/src/bundle_parser.cpp b/services/bundlemgr_lite/src/bundle_parser.cpp index 5a2f84af0e0b63ec5be3dec2ce7e20dcb870fc98..4addebf868589e16c53ef8aaec4e7c3d3a51511c 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;