[En-Nut-Discussion] Upcoming stable release 4.8

Thiago A. Corrêa thiago.correa at gmail.com
Sun Dec 21 13:21:24 CET 2008


> I'd like to publish a new stable release. There may have been new bug
> reports in 4.7 posted to this list recently. However, it is quite time
> consuming to walk through all the messages and trying to figure them out.
>
> If you are aware of a specific problem, please do us a favor add it to
>
> http://sourceforge.net/tracker/?group_id=34079
>

There is a problem with the discovery protocol. It replies with
hostname[8] while confos.hostname is 16 bytes long, so we get
truncated names. Also, if DISCOVERY_TELE.dist_custom isn't zeroed out,
and you don't handle the lack of \0, you might get buffer overruns.
Looks like that could be the case of nutdisc which doesn't check the
received datagram.

I could go ahead and apply this patch (below). The problem is, others
with custom apps might need to change their code if they have made
ethernut discovery apps themselfs like I did.

Given the lack of replies from November 14th mail [1], I guess it's ok
to commit. No one could complain about lack of warning, but still, I'm
trying not to step on anyone's toes.

[1] http://lists.egnite.de/pipermail/en-nut-discussion/2008-November/010068.html

Kind Regards,
   Thiago A. Correa

Index: include/pro/discover.h
===================================================================
RCS file: /cvsroot/ethernut/nut/include/pro/discover.h,v
retrieving revision 1.2
diff -u -r1.2 discover.h
--- include/pro/discover.h	11 Aug 2008 07:00:23 -0000	1.2
+++ include/pro/discover.h	21 Nov 2008 16:46:57 -0000
@@ -71,8 +71,8 @@
     uint32_t dist_ip_mask;        /*!< \brief IP netmask. */
     uint32_t dist_gateway;        /*!< \brief Default route. */
     uint32_t dist_cip_addr;       /*!< \brief Configured IP address. */
-    uint8_t dist_hostname[8];    /*!< \brief Host name of the system. */
-    uint8_t dist_custom[92];     /*!< \brief Bootfile to request. */
+    uint8_t dist_hostname[16];    /*!< \brief Host name of the system. */
+    uint8_t dist_custom[84];     /*!< \brief Bootfile to request. */
 } DISCOVERY_TELE;

 typedef int (*NutDiscoveryCallback) (uint32_t, uint16_t,
DISCOVERY_TELE *, int);
Index: tools/nutdisc/discovery.h
===================================================================
RCS file: /cvsroot/ethernut/nut/tools/nutdisc/discovery.h,v
retrieving revision 1.1
diff -u -r1.1 discovery.h
--- tools/nutdisc/discovery.h	7 Sep 2006 08:58:27 -0000	1.1
+++ tools/nutdisc/discovery.h	21 Dec 2008 11:44:15 -0000
@@ -46,8 +46,8 @@
     u_long dist_ip_mask;        /*!< \brief IP netmask. */
     u_long dist_gateway;        /*!< \brief Default route. */
     u_long dist_cip_addr;       /*!< \brief Configured IP address. */
-    u_char dist_hostname[8];    /*!< \brief Host name of the system. */
-    u_char dist_custom[92];     /*!< \brief Bootfile to request. */
+    u_char dist_hostname[16];    /*!< \brief Host name of the system. */
+    u_char dist_custom[84];     /*!< \brief Bootfile to request. */
 } DISCOVERY_TELE;
 #pragma pack()



More information about the En-Nut-Discussion mailing list