[dvblast-devel] [Git][videolan/dvblast][master] 2 commits: util: fix potential buffer overflow

Christophe Massiot gitlab at videolan.org
Mon Mar 2 01:25:47 CET 2020



Christophe Massiot pushed to branch master at VideoLAN / dvblast


Commits:
980f2185 by Christophe Massiot at 2020-03-02T01:14:19+01:00
util: fix potential buffer overflow

- - - - -
6fa5ef52 by Christophe Massiot at 2020-03-02T01:25:24+01:00
Add new option --udp-lock-timeout.

- - - - -


6 changed files:

- NEWS
- config.h
- dvblast.c
- dvblast.h
- udp.c
- util.c


Changes:

=====================================
NEWS
=====================================
@@ -2,6 +2,7 @@ Changes between 3.4 and 3.5:
 ----------------------------
   * Print bitrate status for each service
   * Fix passing through the EITp/f without EPG tables (broken in 3.3)
+  * Add new option --udp-lock-timeout
 
 Changes between 3.3 and 3.4:
 ----------------------------


=====================================
config.h
=====================================
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * config.h
  *****************************************************************************
- * Copyright (C) 2004, 2008-2011 VideoLAN
+ * Copyright (C) 2004, 2008-2011, 2020 VideoLAN
  *
  * Authors: Christophe Massiot <massiot at via.ecp.fr>
  *          Andy Gatward <a.j.gatward at reading.ac.uk>
@@ -50,6 +50,7 @@
 #define MAX_EIT_RETENTION 500000 /* 500 ms */
 #define DEFAULT_FRONTEND_TIMEOUT 30000000 /* 30 s */
 #define EXIT_STATUS_FRONTEND_TIMEOUT 100
+#define DEFAULT_UDP_LOCK_TIMEOUT 5000000 /* 5 s */
 
 // Compatability defines
 #if defined(__APPLE__)


=====================================
dvblast.c
=====================================
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * dvblast.c
  *****************************************************************************
- * Copyright (C) 2004, 2008-2011, 2015 VideoLAN
+ * Copyright (C) 2004, 2008-2011, 2015, 2020 VideoLAN
  *
  * Authors: Christophe Massiot <massiot at via.ecp.fr>
  *          Andy Gatward <a.j.gatward at reading.ac.uk>
@@ -103,6 +103,7 @@ bool b_print_enabled = false;
 FILE *print_fh;
 mtime_t i_print_period = 0;
 mtime_t i_es_timeout = 0;
+mtime_t i_udp_lock_timeout = DEFAULT_UDP_LOCK_TIMEOUT;
 
 int i_verbose = DEFAULT_VERBOSITY;
 int i_syslog = 0;
@@ -634,7 +635,7 @@ void usage()
         "[-W] [-Y] [-l] [-g <logger ident>] [-Z <mrtg file>] [-V] [-h] [-B <provider_name>] "
         "[-1 <mis_id>] [-2 <size>] [-5 <DVBS|DVBS2|DVBC_ANNEX_A|DVBC_ANNEX_B|DVBT|DVBT2|ATSC|ISDBT>] -y <ca_dev_number> "
         "[-J <DVB charset>] [-Q <quit timeout>] [-0 pid_mapping] [-x <text|xml>]"
-        "[-6 <print period>] [-7 <ES timeout>]" );
+        "[-6 <print period>] [-7 <ES timeout>] [-4 <UDP lock timeout>]" );
 
     msg_Raw( NULL, "Input:" );
 #ifdef HAVE_ASI_SUPPORT
@@ -716,6 +717,7 @@ void usage()
     msg_Raw( NULL, "  -Q --quit-timeout     when locked, quit after this delay (in ms), or after the first lock timeout" );
     msg_Raw( NULL, "  -6 --print-period     periodicity at which we print bitrate and errors (in ms)" );
     msg_Raw( NULL, "  -7 --es-timeout       time of inactivy before which a PID is reported down (in ms)" );
+    msg_Raw( NULL, "  -4 --udp lock-timeout time of inactivy before which a UDP stream is reported down (in ms)" );
     msg_Raw( NULL, "  -r --remote-socket <remote socket>" );
     msg_Raw( NULL, "  -Z --mrtg-file <file> Log input packets and errors into mrtg-file" );
     msg_Raw( NULL, "  -V --version          only display the version" );
@@ -740,8 +742,7 @@ int main( int i_argc, char **pp_argv )
         usage();
 
     /*
-     * The only short options left are: 4
-     * Use them wisely.
+     * No short options are left.
      */
     static const struct option long_options[] =
     {
@@ -802,6 +803,7 @@ int main( int i_argc, char **pp_argv )
         { "quit-timeout",    required_argument, NULL, 'Q' },
         { "print-period",    required_argument, NULL, '6' },
         { "es-timeout",      required_argument, NULL, '7' },
+        { "udp-lock-timeout", required_argument, NULL, '4' },
         { "quiet",           no_argument,       NULL, 'q' },
         { "help",            no_argument,       NULL, 'h' },
         { "version",         no_argument,       NULL, 'V' },
@@ -812,7 +814,7 @@ int main( int i_argc, char **pp_argv )
         { 0, 0, 0, 0 }
     };
 
-    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:5:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:3D:A:lg:zCWYeM:N:j:J:B:x:Q:6:7:hVZ:y:0:1:2:9:", long_options, NULL)) != -1 )
+    while ( (c = getopt_long(i_argc, pp_argv, "q::c:r:t:o:i:a:n:5:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:3D:A:lg:zCWYeM:N:j:J:B:x:Q:6:7:4:hVZ:y:0:1:2:9:", long_options, NULL)) != -1 )
     {
         switch ( c )
         {
@@ -1153,6 +1155,10 @@ int main( int i_argc, char **pp_argv )
             i_es_timeout = strtoll( optarg, NULL, 0 ) * 1000;
             break;
 
+        case '4':
+            i_udp_lock_timeout = strtoll( optarg, NULL, 0 ) * 1000;
+            break;
+
         case 'V':
             DisplayVersion();
             exit(0);


=====================================
dvblast.h
=====================================
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * dvblast.h
  *****************************************************************************
- * Copyright (C) 2004, 2008-2011, 2015-2016 VideoLAN
+ * Copyright (C) 2004, 2008-2011, 2015-2016, 2020 VideoLAN
  *
  * Authors: Christophe Massiot <massiot at via.ecp.fr>
  *          Andy Gatward <a.j.gatward at reading.ac.uk>
@@ -264,6 +264,7 @@ extern bool b_print_enabled;
 extern FILE *print_fh;
 extern mtime_t i_print_period;
 extern mtime_t i_es_timeout;
+extern mtime_t i_udp_lock_timeout;
 
 /* pid mapping */
 extern bool b_do_remap;


=====================================
udp.c
=====================================
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * udp.c: UDP input for DVBlast
  *****************************************************************************
- * Copyright (C) 2009, 2015 VideoLAN
+ * Copyright (C) 2009, 2015, 2020 VideoLAN
  *
  * Authors: Christophe Massiot <massiot at via.ecp.fr>
  *
@@ -48,7 +48,6 @@
 /*****************************************************************************
  * Local declarations
  *****************************************************************************/
-#define UDP_LOCK_TIMEOUT 5000000 /* 5 s */
 #define PRINT_REFRACTORY_PERIOD 1000000 /* 1 s */
 
 static int i_handle;
@@ -278,7 +277,7 @@ void udp_Open( void )
     ev_io_start(event_loop, &udp_watcher);
 
     ev_timer_init(&mute_watcher, udp_MuteCb,
-                  UDP_LOCK_TIMEOUT / 1000000., UDP_LOCK_TIMEOUT / 1000000.);
+                  i_udp_lock_timeout / 1000000., i_udp_lock_timeout / 1000000.);
     memset(&last_addr, 0, sizeof(last_addr));
 }
 


=====================================
util.c
=====================================
@@ -351,7 +351,7 @@ void hexDump( uint8_t *p_data, uint32_t i_len )
     char *p_outline;
     char *p_hrdata;
 
-    p_outline = malloc(69);
+    p_outline = malloc(70);
     p_hrdata  = malloc(17);
 
     for( i = 0; i < i_len; i += 16 )



View it on GitLab: https://code.videolan.org/videolan/dvblast/-/compare/a832ffd80210748f456bb094969ddbbd3bf00680...6fa5ef52443280d293e606510991917ddfbff705

-- 
View it on GitLab: https://code.videolan.org/videolan/dvblast/-/compare/a832ffd80210748f456bb094969ddbbd3bf00680...6fa5ef52443280d293e606510991917ddfbff705
You're receiving this email because of your account on code.videolan.org.




More information about the dvblast-devel mailing list