未验证 提交 3a9c5690 编写于 作者: L Lu_Reaper 提交者: GitHub

[AT] Add null pointer check in at_client_get (#7154)

1. prevent null-pointer dereference in rt_strcmp
上级 dd17ca01
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
......@@ -610,7 +610,8 @@ at_client_t at_client_get(const char *dev_name)
for (idx = 0; idx < AT_CLIENT_NUM_MAX; idx++)
{
if (rt_strcmp(at_client_table[idx].device->parent.name, dev_name) == 0)
if (at_client_table[idx].device &&
(rt_strcmp(at_client_table[idx].device->parent.name, dev_name) == 0))
{
return &at_client_table[idx];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册