[vlc-commits] demux/playlist/dvb: prevent null-dereference on truncated lines

Filip Roséen git at videolan.org
Wed Mar 15 19:34:49 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Mar 15 10:10:37 2017 +0100| [6f3de35b03dca869d3e388da0aff72b00f61b76a] | committer: Jean-Baptiste Kempf

demux/playlist/dvb: prevent null-dereference on truncated lines

All three of ParseFec, ParseModulation, and Parseguard, are
potentially called with NULL (on unexpected (truncated) input), these
changes make sure that we do not dereference the passed pointer if
such happens.

Instead NULL is returned to signal that the parsing failed.

fixes: #18126

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/playlist/dvb.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index d5ef313..72d07d3 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -119,7 +119,7 @@ static const char *ParseFEC(const char *str)
          { "AUTO", "" },   { "NONE", "0" }
      };
 
-     if (strncmp(str, "FEC_", 4))
+     if (str == NULL || strncmp(str, "FEC_", 4))
          return NULL;
      str += 4;
 
@@ -143,6 +143,9 @@ static const char *ParseModulation(const char *str)
          { "VSB_16", "16VSB" }, { "VSB_8", "8VSB" }
      };
 
+     if( str == NULL )
+         return NULL;
+
      const struct mod *m = bsearch(str, tab, sizeof (tab) / sizeof(tab[0]),
                                    sizeof (tab[0]), cmp);
      return (m != NULL) ? m->vlc : NULL;
@@ -160,7 +163,7 @@ static const char *ParseGuard(const char *str)
          { "1_8", "1/8" }, { "AUTO", "" },
      };
 
-     if (strncmp(str, "GUARD_INTERVAL_", 15))
+     if (str == NULL || strncmp(str, "GUARD_INTERVAL_", 15))
          return NULL;
      str += 15;
 



More information about the vlc-commits mailing list