[dvblast-devel] [Git][videolan/dvblast][master] 3 commits: if hour, min or sec is >= 100 we can overflow duration_str

Christophe Massiot gitlab at videolan.org
Tue Sep 1 00:01:17 CEST 2020



Christophe Massiot pushed to branch master at VideoLAN / dvblast


Commits:
ff1e5700 by Marcin Kozlowski at 2020-03-25T08:53:48+01:00
if hour, min or sec is >= 100 we can overflow duration_str

Also use %u for hours as it can be >= 100

- - - - -
71e95679 by Marcin Kozlowski at 2020-04-23T15:12:15+02:00
Fixed forgotten variables

- - - - -
c6fa7806 by Christophe Massiot at 2020-09-01T00:00:46+02:00
Merge branch 'marcinguy-duration-fix'

- - - - -


1 changed file:

- dvblastctl.c


Changes:

=====================================
dvblastctl.c
=====================================
@@ -217,32 +217,31 @@ void print_eit_events(uint8_t *p_eit, f_print pf_print, void *print_opaque, f_ic
     uint8_t j = 0;
     while ((p_event = eit_get_event(p_eit, j)) != NULL) {
         j++;
-        char start_str[24], duration_str[10];
+        char start_str[24];
         int duration, hour, min, sec;
         time_t start_ts;
 
         start_ts = dvb_time_format_UTC(eitn_get_start_time(p_event), NULL, start_str);
 
         dvb_time_decode_bcd(eitn_get_duration_bcd(p_event), &duration, &hour, &min, &sec);
-        sprintf(duration_str, "%02d:%02d:%02d", hour, min, sec);
 
         switch (i_print_type) {
         case PRINT_XML:
             pf_print(print_opaque, "<EVENT id=\"%u\" start_time=\"%ld\" start_time_dec=\"%s\""
-                                   " duration=\"%u\" duration_dec=\"%s\""
+                                   " duration=\"%u\" duration_dec=\"%u:%02u:%02u\""
                                    " running=\"%d\" free_CA=\"%d\">",
                      eitn_get_event_id(p_event),
                      start_ts, start_str,
-                     duration, duration_str,
+                     duration, hour, min, sec,
                      eitn_get_running(p_event),
                      eitn_get_ca(p_event)
                     );
             break;
         default:
-            pf_print(print_opaque, "  * EVENT id=%u start_time=%ld start_time_dec=\"%s\" duration=%u duration_dec=%s running=%d free_CA=%d",
+            pf_print(print_opaque, "  * EVENT id=%u start_time=%ld start_time_dec=\"%s\" duration=%u duration_dec=%u:%02u:%02u running=%d free_CA=%d",
                      eitn_get_event_id(p_event),
                      start_ts, start_str,
-                     duration, duration_str,
+                     duration, hour, min, sec,
                      eitn_get_running(p_event),
                      eitn_get_ca(p_event)
                     );



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

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




More information about the dvblast-devel mailing list