Project

General

Profile

Actions

Bug #1057

closed

master-2013-12-02: zero length structs aren't allowed in C

Added by Mark Solaris over 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Affected Versions:
Effort:
Difficulty:
Label:

Description

sigh...

--- util-mpm-b2gc.h.orig        2013-12-04 16:20:42.506210720 +1100
+++ util-mpm-b2gc.h     2013-12-04 16:20:44.650633645 +1100
@@ -143,6 +143,8 @@
     uint32_t stat_loop_no_match;
     uint32_t stat_num_shift;
     uint32_t stat_total_shift;
+#else
+    uint32_t dummy;
 #endif /* B2GC_COUNTERS */
 } B2gcThreadCtx;

--- ../../suricata-master.orig/src/decode-icmpv4.h      2013-12-01 21:37:52.000000000 +1100
+++ decode-icmpv4.h     2013-12-03 15:07:14.661696076 +1100
@@ -281,6 +281,7 @@
         ICMPV4_GET_TYPE((p)) == ICMP_PARAMETERPROB)

 typedef struct ICMPV4Cache_ {
+    int dummy;
 } ICMPV4Cache;

 void DecodeICMPV4RegisterTests(void);
--- ../../suricata-master.orig/src/decode-udp.h 2013-12-01 21:37:52.000000000 +1100
+++ decode-udp.h        2013-12-03 11:55:39.756816544 +1100
@@ -46,6 +46,7 @@

 typedef struct UDPVars_
 {
+    int dummy;
 } UDPVars;

 #define CLEAR_UDP_PACKET(p) do { \
--- ../../suricata-master.orig/src/source-pcap.h        2013-12-01 21:37:52.000000000 +1100
+++ source-pcap.h       2013-12-03 11:55:21.803988067 +1100
@@ -39,6 +39,7 @@
 /* per packet Pcap vars */
 typedef struct PcapPacketVars_
 {
+    int dummy;
 } PcapPacketVars;

 /** needs to be able to contain Windows adapter id's, so
--- ../../suricata-master.orig/src/util-mpm-b2gc.h      2013-12-01 21:37:52.000000000 +1100
+++ util-mpm-b2gc.h     2013-12-04 16:20:44.650633645 +1100
@@ -143,6 +143,8 @@
     uint32_t stat_loop_no_match;
     uint32_t stat_num_shift;
     uint32_t stat_total_shift;
+#else
+    uint32_t dummy;
 #endif /* B2GC_COUNTERS */
 } B2gcThreadCtx;

Actions #1

Updated by Mark Solaris over 10 years ago

Background:
http://stackoverflow.com/questions/755305/empty-structure-in-c

tl;dr: Empty structs aren't allowed in C. Causes compiler to error.

Actions #2

Updated by Mark Solaris over 10 years ago

Another

--- ../../suricata-master.orig/src/util-mpm-b2g.h       2013-12-01 21:37:52.000000000 +1100
+++ util-mpm-b2g.h      2013-12-04 16:57:49.872759285 +1100
@@ -112,6 +112,8 @@
     uint32_t stat_loop_no_match;
     uint32_t stat_num_shift;
     uint32_t stat_total_shift;
+#else
+    uint32_t dummy;
 #endif /* B2G_COUNTERS */
 } B2gThreadCtx;

Actions #3

Updated by Mark Solaris over 10 years ago

--- ../../suricata-master.orig/src/util-mpm-b2gm.h      2013-12-01 21:37:52.000000000 +1100
+++ util-mpm-b2gm.h     2013-12-04 16:59:24.524498641 +1100
@@ -134,6 +134,8 @@
     uint32_t stat_test_buf;
     uint32_t stat_test_buf_ok;
     uint32_t stat_test_buf_fail;
+#else
+    uint32_t dummy;
 #endif /* B2GM_COUNTERS */
 } B2gmThreadCtx;

Actions #4

Updated by Mark Solaris over 10 years ago

--- ../../suricata-master.orig/src/util-mpm-b3g.h       2013-12-01 21:37:52.000000000 +1100
+++ util-mpm-b3g.h      2013-12-04 17:01:25.099252973 +1100
@@ -115,6 +115,8 @@
     uint32_t stat_loop_no_match;
     uint32_t stat_num_shift;
     uint32_t stat_total_shift;
+#else
+    uint32_t dummy;
 #endif /* B3G_COUNTERS */
 } B3gThreadCtx;

Actions #5

Updated by Mark Solaris over 10 years ago

--- ../../suricata-master.orig/src/util-mpm-wumanber.h  2013-12-01 21:37:52.000000000 +1100
+++ util-mpm-wumanber.h 2013-12-04 17:02:42.272809084 +1100
@@ -83,6 +83,8 @@
     uint32_t stat_loop_no_match;
     uint32_t stat_num_shift;
     uint32_t stat_total_shift;
+#else
+    uint32_t dummy;
 #endif /* WUMANBER_COUNTERS */
 } WmThreadCtx;

Actions #6

Updated by Andreas Herz over 8 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF