diff options
author | John Stebbins <[email protected]> | 2019-02-11 08:04:24 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-02-11 08:04:24 -0700 |
commit | 67299770c013120ffdc4d86daffc9c48691ab802 (patch) | |
tree | 536ddf3f4307c80d44f050d46ba0fdd37259fcb1 /libhb | |
parent | 9a24efca579f841bc84b345969bd4582dbee24f8 (diff) |
scan: fix potential buffer overflow in sprintf
Use snprintf
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/scan.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libhb/scan.c b/libhb/scan.c index 5d97b27d1..f1e0de230 100644 --- a/libhb/scan.c +++ b/libhb/scan.c @@ -1297,21 +1297,20 @@ static void LookForAudio(hb_scan_t *scan, hb_title_t * title, hb_buffer_t * b) break; } } - if (codec_name != NULL && profile_name != NULL) { - sprintf(audio->config.lang.description, "%s (%s %s)", - audio->config.lang.simple, codec_name, profile_name); + snprintf(audio->config.lang.description, sizeof(audio->config.lang.description), + "%s (%s %s)", audio->config.lang.simple, codec_name, profile_name); } else if (codec_name != NULL) { - sprintf(audio->config.lang.description, "%s (%s)", - audio->config.lang.simple, codec_name); + snprintf(audio->config.lang.description, sizeof(audio->config.lang.description), + "%s (%s)", audio->config.lang.simple, codec_name); } else if (profile_name != NULL) { - sprintf(audio->config.lang.description, "%s (%s)", - audio->config.lang.simple, profile_name); + snprintf(audio->config.lang.description, sizeof(audio->config.lang.description), + "%s (%s)", audio->config.lang.simple, profile_name); } if (audio->config.lang.attributes & HB_AUDIO_ATTR_VISUALLY_IMPAIRED) |