diff --git a/libavformat/mov.c b/libavformat/mov.c index 06c15fba6dd4e1686e4856d29430ca1b6f68ba6e..73bff0929b3e5a6a3d14a0a0a38f2e51cb62ebe7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -597,6 +597,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } + // trim string of any ending zeros + for (j = len - 1; j >= 0; j--) { + if (dref->path[j] == 0) + len--; + else + break; + } for (j = 0; j < len; j++) if (dref->path[j] == ':' || dref->path[j] == 0) dref->path[j] = '/';