未验证 提交 2533fdd5 编写于 作者: D David Lin 提交者: GitHub

Update osal_os.c

strncpy(version, ver, IOTX_FIRMWARE_VER_LEN)
->
strncpy(version, ver, len);
上级 bbdedd49
...@@ -173,7 +173,7 @@ int HAL_GetFirmwareVersion(char *version) ...@@ -173,7 +173,7 @@ int HAL_GetFirmwareVersion(char *version)
char *ver = "app-1.0.0-20180101.1000"; char *ver = "app-1.0.0-20180101.1000";
int len = strlen(ver); int len = strlen(ver);
memset(version, 0x0, IOTX_FIRMWARE_VER_LEN); memset(version, 0x0, IOTX_FIRMWARE_VER_LEN);
strncpy(version, ver, IOTX_FIRMWARE_VER_LEN); strncpy(version, ver, len);
version[len] = '\0'; version[len] = '\0';
return strlen(version); return strlen(version);
} }
...@@ -190,7 +190,7 @@ void *HAL_MutexCreate(void) ...@@ -190,7 +190,7 @@ void *HAL_MutexCreate(void)
void HAL_MutexDestroy(void *mutex) void HAL_MutexDestroy(void *mutex)
{ {
k_err_t ret; k_err_t ret;
if (K_ERR_NONE != (ret = tos_mutex_destroy((k_mutex_t *)mutex))) { if (K_ERR_NONE != (ret = tos_mutex_destroy((k_mutex_t *)mutex))) {
HAL_Printf("osal_mutex_destroy err, err:%d\n\r", ret); HAL_Printf("osal_mutex_destroy err, err:%d\n\r", ret);
...@@ -210,16 +210,16 @@ void HAL_MutexLock(void *mutex) ...@@ -210,16 +210,16 @@ void HAL_MutexLock(void *mutex)
void HAL_MutexUnlock(void *mutex) void HAL_MutexUnlock(void *mutex)
{ {
k_err_t ret; k_err_t ret;
if (K_ERR_NONE != (ret = tos_mutex_post((k_mutex_t *)mutex))) { if (K_ERR_NONE != (ret = tos_mutex_post((k_mutex_t *)mutex))) {
HAL_Printf("osal_mutex_unlock err, err:%d\n\r", ret); HAL_Printf("osal_mutex_unlock err, err:%d\n\r", ret);
} }
} }
void *HAL_Malloc(uint32_t size) void *HAL_Malloc(uint32_t size)
{ {
return tos_mmheap_alloc(size); return tos_mmheap_alloc(size);
} }
void HAL_Free(void *ptr) void HAL_Free(void *ptr)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册