Use the safer strlcpy to copy the chapter names to the mp4v2 struct.
This commit is contained in:
1 parent
1fb07668f3
commit
bd057347ce
1 file changed
+6
-4
@@ -180,7 +180,7 @@
|
|||||||
BOOL success = YES;
|
BOOL success = YES;
|
||||||
|
|
||||||
if ((self.edited && _areChaptersEdited) || !self.muxed) {
|
if ((self.edited && _areChaptersEdited) || !self.muxed) {
|
||||||
MP4Chapter_t * fileChapters = 0;
|
MP4Chapter_t *fileChapters = 0;
|
||||||
MP4Duration refTrackDuration;
|
MP4Duration refTrackDuration;
|
||||||
uint32_t chapterCount = 0;
|
uint32_t chapterCount = 0;
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
@@ -221,9 +221,11 @@
|
|||||||
refTrackDuration = moovDuration;
|
refTrackDuration = moovDuration;
|
||||||
|
|
||||||
for (i = 0; i < chapterCount; i++) {
|
for (i = 0; i < chapterCount; i++) {
|
||||||
MP42TextSample *chapter = [_chapters objectAtIndex:i];
|
MP42TextSample *chapter = _chapters[i];
|
||||||
if ([[chapter title] UTF8String])
|
const char *title = chapter.title.UTF8String;
|
||||||
strcpy(fileChapters[i].title, [[chapter title] UTF8String]);
|
if (title) {
|
||||||
|
strlcpy(fileChapters[i].title, title, MP4V2_CHAPTER_TITLE_MAX + 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (i + 1 < chapterCount && sum < refTrackDuration) {
|
if (i + 1 < chapterCount && sum < refTrackDuration) {
|
||||||
MP42TextSample * nextChapter = [_chapters objectAtIndex:i+1];
|
MP42TextSample * nextChapter = [_chapters objectAtIndex:i+1];
|
||||||
|
|||||||
Reference in new issue
Block a user