Skip to content

Commit 08f18db

Browse files
committed
[module-ffmpeg] Fixed file path with spaces.
1 parent 591c1a7 commit 08f18db

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

modules/ffmpeg/module.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,19 @@ static int file_open(URLContext *h, const char *filename, int flags) {
1717
file_t fd;
1818
int _flags = 0;
1919
char fn[NAME_MAX];
20-
char proto[32];
20+
const char *path_start = strchr(filename, ':');
2121

22-
sscanf(filename, "%[a-zA-Z0-9_]:%s", proto, fn);
22+
if(path_start) {
23+
path_start++;
24+
while(*path_start == ' ') {
25+
path_start++;
26+
}
27+
strncpy(fn, path_start, NAME_MAX);
28+
}
29+
else {
30+
strncpy(fn, filename, NAME_MAX);
31+
}
32+
fn[NAME_MAX - 1] = '\0';
2333

2434
if(strncmp(fn, "/sd", 3) == 0) {
2535
h->max_packet_size = 8 << 10;

0 commit comments

Comments
 (0)