[vlc-devel] [PATCH 3/4] cdda: fix format-truncation warning
Thomas Guillem
thomas at gllm.fr
Wed Apr 7 13:31:25 UTC 2021
---
modules/access/cdda.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index 0c3d25cb808..18756899a74 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -653,8 +653,9 @@ static void AccessGetMeta(stream_t *access, vlc_meta_t *meta)
{
char yearbuf[5];
- snprintf(yearbuf, sizeof (yearbuf), "%u", year);
- vlc_meta_SetDate(meta, yearbuf);
+ int ret = snprintf(yearbuf, sizeof (yearbuf), "%u", year);
+ if (ret >= 0 && (size_t) ret < sizeof (yearbuf))
+ vlc_meta_SetDate(meta, yearbuf);
}
/* Set artist only if identical across tracks */
--
2.30.0
More information about the vlc-devel
mailing list