[vlc-commits] Avoid zero-length array

Rémi Denis-Courmont git at videolan.org
Tue Jan 15 22:15:40 CET 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jan 15 22:33:35 2013 +0200| [3320071d3db1e96f50c5f8d4ae92e288e1f48764] | committer: Rémi Denis-Courmont

Avoid zero-length array

While useful, this is not permitted by the standard specification.
This patch will waste a little bit of memory in affected allocations...

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3320071d3db1e96f50c5f8d4ae92e288e1f48764
---

 modules/access/rtp/session.c |    2 +-
 modules/access/sdp.c         |    2 +-
 modules/demux/smf.c          |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/access/rtp/session.c b/modules/access/rtp/session.c
index 5af1199..a2699df 100644
--- a/modules/access/rtp/session.c
+++ b/modules/access/rtp/session.c
@@ -149,7 +149,7 @@ struct rtp_source_t
 
     uint16_t last_seq; /* sequence of the next dequeued packet */
     block_t *blocks; /* re-ordered blocks queue */
-    void    *opaque[0]; /* Per-source private payload data */
+    void    *opaque[1]; /* Per-source private payload data */
 };
 
 /**
diff --git a/modules/access/sdp.c b/modules/access/sdp.c
index 4c22a70..05be729 100644
--- a/modules/access/sdp.c
+++ b/modules/access/sdp.c
@@ -47,7 +47,7 @@ static int Control (access_t *, int, va_list);
 struct access_sys_t
 {
     size_t length;
-    char   data[0];
+    char   data[1];
 };
 
 static int Open (vlc_object_t *obj)
diff --git a/modules/demux/smf.c b/modules/demux/smf.c
index bc75fa2..e98dcf5 100644
--- a/modules/demux/smf.c
+++ b/modules/demux/smf.c
@@ -68,7 +68,7 @@ struct demux_sys_t
     /* by the way, "quarter note" is "noire" in French */
 
     unsigned     trackc; /* Number of tracks */
-    mtrk_t       trackv[0]; /* Track states */
+    mtrk_t       trackv[1]; /* Track states */
 };
 
 /*****************************************************************************



More information about the vlc-commits mailing list