[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1] kdd: remove zero-length arrays



Am Wed, 10 Jun 2020 20:16:57 +0100
schrieb Tim Deegan <tim@xxxxxxx>:

> How tedious.

Indeed. This compiles for me as well:

--- orig/kdd.h  2020-06-08 17:40:05.000000000 +0000
+++ kdd.h       2020-06-11 19:00:44.234364040 +0000
@@ -68,7 +68,6 @@
     uint16_t len;     /* Payload length, excl. header and trailing byte */
     uint32_t id;      /* Echoed in responses */
     uint32_t sum;     /* Unsigned sum of all payload bytes */
-    uint8_t payload[0];
 } PACKED kdd_hdr;
 
 #define KDD_PKT_CMD 0x0002      /* Debugger commands (and replies to them) */
@@ -323,7 +322,7 @@
         kdd_msg msg;
         kdd_reg reg;
         kdd_stc stc;
-        uint8_t payload[0];
+        uint8_t payload[65536];
     };
 } PACKED kdd_pkt;
 
--- orig/kdd.c  2020-06-08 17:40:05.000000000 +0000
+++ kdd.c       2020-06-11 19:08:36.775724640 +0000
@@ -79,11 +79,11 @@
 /* State of the debugger stub */
 typedef struct {
     union {
-        uint8_t txb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for tx */
+        uint8_t txb[sizeof (kdd_hdr) + 0xffff];   /* Marshalling area for tx */
         kdd_pkt txp;                 /* Also readable as a packet structure */
     };
     union {
-        uint8_t rxb[sizeof (kdd_hdr) + 65536];   /* Marshalling area for rx */
+        uint8_t rxb[sizeof (kdd_hdr)];   /* Marshalling area for rx */
         kdd_pkt rxp;                 /* Also readable as a packet structure */
     };
     unsigned int cur;       /* Offset into rx where we'll put the next byte */

Olaf

Attachment: pgpAOenkZUNql.pgp
Description: Digitale Signatur von OpenPGP


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.