Skip to content

Commit

Permalink
fix: andlink_get_device_ipaddr存在变量未初始化的可能性
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Nov 25, 2023
1 parent c26f7a2 commit 3222e24
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion project/example_andlink/src/luat_andlink_ec618.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int andlink_dn_send_cmd_callback(RESP_MODE_e mode, dn_dev_ctrl_frame_t *ctrlFram

// 获取设备IP
int andlink_get_device_ipaddr(char *ip, char *broadAddr){
char *ipaddr;
char *ipaddr = NULL;
ip_addr_t ipv4;
ip_addr_t ipv6;
while (luat_is_link_up == 0){
Expand All @@ -50,6 +50,9 @@ int andlink_get_device_ipaddr(char *ip, char *broadAddr){
if (ipv6.type != 0xff){
ipaddr = ip4addr_ntoa(&ipv4.u_addr.ip6);
}
if (ipaddr == NULL) {
return -1;
}
memcpy(ip, ipaddr, strlen(ipaddr));
return 0;
}
Expand Down

0 comments on commit 3222e24

Please sign in to comment.