[En-Nut-Discussion] Ethernet problem, application crash, problem in NutTcpReceive

Michael Fischer fischermi at t-online.de
Sun Dec 2 17:18:24 CET 2018


Hello Uwe,

>I compiled for the STM32F746 Discovery and can start and stop iperf2
>runs without crashes. Do crashes happen for you on the F7 disco?
I can reproduce the crash here too with the F7 disco board. With the patch it works.

Attached is my patch too.

Best regards,
Michael

-------------- next part --------------
diff -Naur nut-r6730/nut/net/tcpsock.c nut-r6730-new/nut/net/tcpsock.c
--- nut-r6730/nut/net/tcpsock.c	2017-04-13 16:05:46.000000000 +0200
+++ nut-r6730-new/nut/net/tcpsock.c	2018-12-02 17:11:52.662014000 +0100
@@ -637,6 +637,14 @@
             return 0;
     }
 
+
+    /* Check again for terminated connection with empty buffer */
+    if ((sock->so_state != TCPS_ESTABLISHED) && (NULL == sock->so_rx_buf)) {
+        sock->so_last_error = ENOTCONN;
+        return -1;
+    }
+
+
     if (size > sock->so_rx_cnt - sock->so_rd_cnt)
         size = sock->so_rx_cnt - sock->so_rd_cnt;
     if (size) {


More information about the En-Nut-Discussion mailing list