system/ping: Fix a segmentation fault when using ping

nsh> ping google.com
[   37.180000] dns_query_error: ERROR: IPv4 dns_recv_response fa: -84,
               server address: 8.8.8.8
Segmentation fault.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan Carvalho de Assis 2026-07-07 19:13:22 -03:00 committed by Xiang Xiao
parent 0566af556a
commit 707b24e5cb
2 changed files with 4 additions and 0 deletions

View file

@ -345,6 +345,8 @@ int main(int argc, FAR char *argv[])
int exitcode;
int option;
memset(&info, 0, sizeof(info));
info.count = ICMP_NPINGS;
info.datalen = ICMP_PING_DATALEN;
info.delay = ICMP_POLL_DELAY;

View file

@ -286,6 +286,8 @@ int main(int argc, FAR char *argv[])
int exitcode;
int option;
memset(&info, 0, sizeof(info));
info.count = ICMPv6_NPINGS;
info.datalen = ICMPv6_PING6_DATALEN;
info.delay = ICMPv6_POLL_DELAY;