Use the safer strlcpy to copy the chapter names to the mp4v2 struct.

This commit is contained in:
Damiano Galassi committed 2016-12-07 10:16:33 +01:00
1 parent 1fb07668f3
commit bd057347ce
1 file changed
+5 -3
+5 -3
View File
@@ -221,9 +221,11 @@
refTrackDuration = moovDuration;
for (i = 0; i < chapterCount; i++) {
MP42TextSample *chapter = [_chapters objectAtIndex:i];
if ([[chapter title] UTF8String])
strcpy(fileChapters[i].title, [[chapter title] UTF8String]);
MP42TextSample *chapter = _chapters[i];
const char *title = chapter.title.UTF8String;
if (title) {
strlcpy(fileChapters[i].title, title, MP4V2_CHAPTER_TITLE_MAX + 1);
}
if (i + 1 < chapterCount && sum < refTrackDuration) {
MP42TextSample * nextChapter = [_chapters objectAtIndex:i+1];