From: Niki Roo Date: Fri, 5 Jul 2024 18:45:45 +0000 (+0200) Subject: fix printf w/o enough space X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=308d793b21af04a0fce5514d193d1ffdffca5aa2;p=nsub.git fix printf w/o enough space --- diff --git a/src/nsub/nsub_write_lrc.c b/src/nsub/nsub_write_lrc.c index 08c1470..1d42815 100644 --- a/src/nsub/nsub_write_lrc.c +++ b/src/nsub/nsub_write_lrc.c @@ -139,7 +139,7 @@ char *nsub_lrc_time_str(int time, int show_sign) { int s = ((time / 1000)) % 60; int c = (time / 10) % 100; - char *time_str = malloc(12 * sizeof(char)); + char *time_str = malloc(14 * sizeof(char)); if (h) { sprintf(time_str, "%s%d:%02d:%02d.%02d", sign, h, m, s, c); diff --git a/src/nsub/nsub_write_srt.c b/src/nsub/nsub_write_srt.c index 0cb0e4a..2ecaa25 100644 --- a/src/nsub/nsub_write_srt.c +++ b/src/nsub/nsub_write_srt.c @@ -93,7 +93,7 @@ char *nsub_srt_time_str(int time, int show_sign) { int s = ((time / 1000)) % 60; int c = (time) % 1000; - char *time_str = malloc(12 * sizeof(char)); + char *time_str = malloc(14 * sizeof(char)); sprintf(time_str, "%s%02d:%02d:%02d,%03d", sign, h, m, s, c); diff --git a/src/nsub/nsub_write_webvtt.c b/src/nsub/nsub_write_webvtt.c index 1b6c571..761bc46 100644 --- a/src/nsub/nsub_write_webvtt.c +++ b/src/nsub/nsub_write_webvtt.c @@ -110,7 +110,7 @@ char *nsub_webvtt_time_str(int time, int show_sign) { int s = ((time / 1000)) % 60; int c = (time) % 1000; - char *time_str = malloc(12 * sizeof(char)); + char *time_str = malloc(14 * sizeof(char)); if (h) { sprintf(time_str, "%s%d:%02d:%02d.%03d", sign, h, m, s, c);