diff --git a/services/updater_binary/update_image_patch.cpp b/services/updater_binary/update_image_patch.cpp index 5ce712dded0970f3c9c9a190f833553bb9261214..ec3b3c58496b4fe11ad57b95805e37ed5dec2126 100644 --- a/services/updater_binary/update_image_patch.cpp +++ b/services/updater_binary/update_image_patch.cpp @@ -290,7 +290,11 @@ int32_t USInstrImageShaCheck::CheckHash(const CheckPara ¶) LOG(ERROR) << "para size error " << para.srcSize; return USCRIPT_ERROR_EXECUTE; } - size_t length = std::stoul(para.srcSize); + uint32_t length = 0; + if (!Utils::ConvertToUnsignedLong(para.srcSize, length)) { + LOG(ERROR) << "ConvertToUnsignedLong error"; + return USCRIPT_ERROR_EXECUTE; + } UpdatePatch::BlockBuffer data = { mapBuffer.memory, length }; std::string resultSha = UpdatePatch::GeneraterBufferHash(data); std::transform(resultSha.begin(), resultSha.end(), resultSha.begin(), ::toupper);