Update HAL_Device_tencentos_tiny.c
Fixed hidden bug may cause stackover flow
This commit is contained in:
@@ -143,11 +143,13 @@ int HAL_GetGwDevInfo(void *pgwDeviceInfo)
|
|||||||
//only one sub-device is supported now
|
//only one sub-device is supported now
|
||||||
gwDevInfo->sub_dev_num = 1;
|
gwDevInfo->sub_dev_num = 1;
|
||||||
gwDevInfo->sub_dev_info = (DeviceInfo *)HAL_Malloc(sizeof(DeviceInfo)*(gwDevInfo->sub_dev_num));
|
gwDevInfo->sub_dev_info = (DeviceInfo *)HAL_Malloc(sizeof(DeviceInfo)*(gwDevInfo->sub_dev_num));
|
||||||
memset((char *)gwDevInfo->sub_dev_info, '\0', sizeof(DeviceInfo));
|
if(gwDevInfo->sub_dev_info)
|
||||||
//copy sub dev info
|
{
|
||||||
ret = device_info_copy(gwDevInfo->sub_dev_info->product_id, sg_sub_device_product_id, MAX_SIZE_OF_PRODUCT_ID);
|
memset((char *)gwDevInfo->sub_dev_info, '\0', sizeof(DeviceInfo));
|
||||||
ret |= device_info_copy(gwDevInfo->sub_dev_info->device_name, sg_sub_device_name, MAX_SIZE_OF_DEVICE_NAME);
|
//copy sub dev info
|
||||||
|
ret = device_info_copy(gwDevInfo->sub_dev_info->product_id, sg_sub_device_product_id, MAX_SIZE_OF_PRODUCT_ID);
|
||||||
|
ret |= device_info_copy(gwDevInfo->sub_dev_info->device_name, sg_sub_device_name, MAX_SIZE_OF_DEVICE_NAME);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
Log_e("HAL_GetDevInfo not implement yet");
|
Log_e("HAL_GetDevInfo not implement yet");
|
||||||
ret = QCLOUD_ERR_DEV_INFO;
|
ret = QCLOUD_ERR_DEV_INFO;
|
||||||
|
Reference in New Issue
Block a user