1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-29 22:00:58 +02:00

avio: Fix handling of filenames that contain :

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-11-24 15:03:27 +01:00
parent 32ed7da135
commit 58030fc6c8

View File

@ -288,17 +288,17 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
{ {
URLProtocol *up = NULL; URLProtocol *up = NULL;
char proto_str[128], proto_nested[128], *ptr; char proto_str[128], proto_nested[128], *ptr;
const char *proto_end = strchr(filename, ':'); size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
if (!first_protocol) { if (!first_protocol) {
av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. " av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. "
"Missing call to av_register_all()?\n"); "Missing call to av_register_all()?\n");
} }
if (!proto_end || is_dos_path(filename)) if (filename[proto_len] != ':' && filename[proto_len] != ',' || is_dos_path(filename))
strcpy(proto_str, "file"); strcpy(proto_str, "file");
else else
av_strlcpy(proto_str, filename, FFMIN(proto_end-filename+1, sizeof(proto_str))); av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
if ((ptr = strchr(proto_str, ','))) if ((ptr = strchr(proto_str, ',')))
*ptr = '\0'; *ptr = '\0';