This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 707b24e5c system/ping: Fix a segmentation fault when using ping
707b24e5c is described below

commit 707b24e5cbdc3b934c848d3decdb49f41b6cd4f1
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Tue Jul 7 19:13:22 2026 -0300

    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 <[email protected]>
---
 system/ping/ping.c   | 2 ++
 system/ping6/ping6.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/system/ping/ping.c b/system/ping/ping.c
index 4588393ab..bc5e20ea8 100644
--- a/system/ping/ping.c
+++ b/system/ping/ping.c
@@ -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;
diff --git a/system/ping6/ping6.c b/system/ping6/ping6.c
index 409f3db0e..e4644ede6 100644
--- a/system/ping6/ping6.c
+++ b/system/ping6/ping6.c
@@ -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;

Reply via email to