disc & conn modify code check and modify risk function

Signed-off-by: w00644978 <wudy062379@126.com>
This commit is contained in:
w00644978 2022-09-26 09:23:01 +08:00
parent 9446fbe9fd
commit 714fbfff43
3 changed files with 12 additions and 11 deletions

View File

@ -175,21 +175,21 @@ static SoftBusEvtReportMsg *GetRateOfSuccessMsg(LnnStatisticData *data)
msg->paramArray[EVT_INDEX_ONE].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_ONE].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_SUCCESS_COUNT) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_SUCCESS_COUNT);
break;
}
msg->paramArray[EVT_INDEX_TWO].paramType = SOFTBUS_EVT_PARAMTYPE_FLOAT;
if (strcpy_s(msg->paramArray[EVT_INDEX_TWO].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_SUCCESS_RATE) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_SUCCESS_RATE);
break;
}
msg->paramArray[EVT_INDEX_THREE].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_THREE].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_CONN_TYPE) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_CONN_TYPE);
break;
}
@ -243,21 +243,21 @@ static SoftBusEvtReportMsg *GetDurationMsg(LnnStatisticData *data)
msg->paramArray[EVT_INDEX_ZERO].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_ZERO].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_AVG_DURATION) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_AVG_DURATION);
break;
}
msg->paramArray[EVT_INDEX_ONE].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_ONE].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_MAX_DURATION) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_MAX_DURATION);
break;
}
msg->paramArray[EVT_INDEX_TWO].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_TWO].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_MIN_DURATION) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_MIN_DURATION);
break;
}
@ -359,21 +359,21 @@ static int32_t MakeFaultEvt(SoftBusEvtReportMsg *msg)
msg->paramArray[EVT_INDEX_ZERO].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_ZERO].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
FAULT_EVT_BUS_PARAM_ERROR) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
FAULT_EVT_BUS_PARAM_ERROR);
break;
}
msg->paramArray[EVT_INDEX_ONE].paramType = SOFTBUS_EVT_PARAMTYPE_STRING;
if (strcpy_s(msg->paramArray[EVT_INDEX_ONE].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
FAULT_EVT_BUS_PARAM_ERROR_STR) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
FAULT_EVT_BUS_PARAM_ERROR_STR);
break;
}
msg->paramArray[EVT_INDEX_TWO].paramType = SOFTBUS_EVT_PARAMTYPE_INT32;
if (strcpy_s(msg->paramArray[EVT_INDEX_TWO].paramName, SOFTBUS_HISYSEVT_PARAM_LEN,
BUS_CENTER_PARAM_CONN_TYPE) != EOK) {
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
SoftBusLog(SOFTBUS_LOG_LNN, SOFTBUS_LOG_ERROR, " strcpy_s param name %s fail",
BUS_CENTER_PARAM_CONN_TYPE);
break;
}

View File

@ -1014,6 +1014,7 @@ static int32_t RegisterCapability(DiscBleInfo *info, const DiscBleOption *option
}
}
if (memcpy_s(info->capabilityData[pos], CUST_DATA_MAX_LEN, custData, custDataLen) != EOK) {
SoftBusFree(info->capabilityData[pos]);
return SOFTBUS_MEM_ERR;
}
info->capDataLen[pos] = custDataLen;

View File

@ -1102,13 +1102,13 @@ static IdContainer* CreateIdContainer(int32_t id, const char *pkgName)
if (pkgName == NULL) {
return container;
}
uint32_t nameLen = strlen(pkgName) + 1;
uint32_t nameLen = strlen(pkgName) + 1;
container->pkgName = SoftBusCalloc(nameLen);
if (container->pkgName == NULL) {
SoftBusFree(container);
return NULL;
}
if (strcpy_s(container->pkgName, nameLen , pkgName) != EOK) {
if (strcpy_s(container->pkgName, nameLen, pkgName) != EOK) {
SoftBusLog(SOFTBUS_LOG_DISC, SOFTBUS_LOG_ERROR, "CreateIdContainer strcpy_s fail");
SoftBusFree(container);
return NULL;