Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: normalize path before using it #15165

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions common/playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,8 @@ void playlist_set_current(struct playlist *pl)
for (int i = 0; i < pl->num_entries; ++i) {
if (!pl->entries[i]->playlist_path)
continue;
char *path = pl->entries[i]->playlist_path;
if (path[0] != '.')
path = mp_path_join(NULL, pl->playlist_dir, mp_basename(pl->entries[i]->playlist_path));
bool same = !strcmp(pl->entries[i]->filename, path);
if (path != pl->entries[i]->playlist_path)
talloc_free(path);
if (same) {
char *path = mp_normalize_path(pl, pl->entries[i]->playlist_path);
if (!strcmp(pl->entries[i]->filename, path)) {
pl->current = pl->entries[i];
break;
}
Expand Down
2 changes: 1 addition & 1 deletion demux/demux_playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ static bool scan_dir(struct pl_parser *p, char *path,
if (mp_cancel_test(p->s->cancel))
break;

char *file = mp_path_join(p, path, ep->d_name);
char *file = mp_normalize_path(p, mp_path_join(p, path, ep->d_name));

struct stat st;
if (stat(file, &st) == 0 && S_ISDIR(st.st_mode)) {
Expand Down
2 changes: 1 addition & 1 deletion stream/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ static int stream_create_instance(const stream_info_t *sinfo,
s->info = sinfo;
s->cancel = args->cancel;
s->url = talloc_strdup(s, url);
s->path = talloc_strdup(s, path);
s->path = mp_normalize_path(s, path);
s->mode = flags & (STREAM_READ | STREAM_WRITE);
s->requested_buffer_size = opts->buffer_size;
s->allow_partial_read = flags & STREAM_ALLOW_PARTIAL_READ;
Expand Down
Loading