Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
31d77ec5
Commit
31d77ec5
authored
Jan 03, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl, ...: use strncmp() instead of memcmp() to avoid crash
parent
06116382
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
11 deletions
+11
-11
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+2
-2
SoundCloudPlaylistPlugin.cxx
src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
+6
-6
NfsStorage.cxx
src/storage/plugins/NfsStorage.cxx
+1
-1
SmbclientStorage.cxx
src/storage/plugins/SmbclientStorage.cxx
+1
-1
test_translate_song.cxx
test/test_translate_song.cxx
+1
-1
No files found.
src/input/plugins/CurlInputPlugin.cxx
View file @
31d77ec5
...
@@ -433,8 +433,8 @@ CurlInputStream::Open(const char *url, Mutex &mutex, Cond &cond)
...
@@ -433,8 +433,8 @@ CurlInputStream::Open(const char *url, Mutex &mutex, Cond &cond)
static
InputStream
*
static
InputStream
*
input_curl_open
(
const
char
*
url
,
Mutex
&
mutex
,
Cond
&
cond
)
input_curl_open
(
const
char
*
url
,
Mutex
&
mutex
,
Cond
&
cond
)
{
{
if
(
memcmp
(
url
,
"http://"
,
7
)
!=
0
&&
if
(
strncmp
(
url
,
"http://"
,
7
)
!=
0
&&
mem
cmp
(
url
,
"https://"
,
8
)
!=
0
)
strn
cmp
(
url
,
"https://"
,
8
)
!=
0
)
return
nullptr
;
return
nullptr
;
return
CurlInputStream
::
Open
(
url
,
mutex
,
cond
);
return
CurlInputStream
::
Open
(
url
,
mutex
,
cond
);
...
...
src/playlist/plugins/SoundCloudPlaylistPlugin.cxx
View file @
31d77ec5
...
@@ -274,31 +274,31 @@ try {
...
@@ -274,31 +274,31 @@ try {
static
SongEnumerator
*
static
SongEnumerator
*
soundcloud_open_uri
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
soundcloud_open_uri
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
{
{
assert
(
mem
cmp
(
uri
,
"soundcloud://"
,
13
)
==
0
);
assert
(
strn
cmp
(
uri
,
"soundcloud://"
,
13
)
==
0
);
uri
+=
13
;
uri
+=
13
;
char
*
u
=
nullptr
;
char
*
u
=
nullptr
;
if
(
mem
cmp
(
uri
,
"track/"
,
6
)
==
0
)
{
if
(
strn
cmp
(
uri
,
"track/"
,
6
)
==
0
)
{
const
char
*
rest
=
uri
+
6
;
const
char
*
rest
=
uri
+
6
;
u
=
xstrcatdup
(
"https://api.soundcloud.com/tracks/"
,
u
=
xstrcatdup
(
"https://api.soundcloud.com/tracks/"
,
rest
,
".json?client_id="
,
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
.
c_str
());
soundcloud_config
.
apikey
.
c_str
());
}
else
if
(
mem
cmp
(
uri
,
"playlist/"
,
9
)
==
0
)
{
}
else
if
(
strn
cmp
(
uri
,
"playlist/"
,
9
)
==
0
)
{
const
char
*
rest
=
uri
+
9
;
const
char
*
rest
=
uri
+
9
;
u
=
xstrcatdup
(
"https://api.soundcloud.com/playlists/"
,
u
=
xstrcatdup
(
"https://api.soundcloud.com/playlists/"
,
rest
,
".json?client_id="
,
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
.
c_str
());
soundcloud_config
.
apikey
.
c_str
());
}
else
if
(
mem
cmp
(
uri
,
"user/"
,
5
)
==
0
)
{
}
else
if
(
strn
cmp
(
uri
,
"user/"
,
5
)
==
0
)
{
const
char
*
rest
=
uri
+
5
;
const
char
*
rest
=
uri
+
5
;
u
=
xstrcatdup
(
"https://api.soundcloud.com/users/"
,
u
=
xstrcatdup
(
"https://api.soundcloud.com/users/"
,
rest
,
"/tracks.json?client_id="
,
rest
,
"/tracks.json?client_id="
,
soundcloud_config
.
apikey
.
c_str
());
soundcloud_config
.
apikey
.
c_str
());
}
else
if
(
mem
cmp
(
uri
,
"search/"
,
7
)
==
0
)
{
}
else
if
(
strn
cmp
(
uri
,
"search/"
,
7
)
==
0
)
{
const
char
*
rest
=
uri
+
7
;
const
char
*
rest
=
uri
+
7
;
u
=
xstrcatdup
(
"https://api.soundcloud.com/tracks.json?q="
,
u
=
xstrcatdup
(
"https://api.soundcloud.com/tracks.json?q="
,
rest
,
"&client_id="
,
rest
,
"&client_id="
,
soundcloud_config
.
apikey
.
c_str
());
soundcloud_config
.
apikey
.
c_str
());
}
else
if
(
mem
cmp
(
uri
,
"url/"
,
4
)
==
0
)
{
}
else
if
(
strn
cmp
(
uri
,
"url/"
,
4
)
==
0
)
{
const
char
*
rest
=
uri
+
4
;
const
char
*
rest
=
uri
+
4
;
/* Translate to soundcloud resolver call. libcurl will automatically
/* Translate to soundcloud resolver call. libcurl will automatically
follow the redirect to the right resource. */
follow the redirect to the right resource. */
...
...
src/storage/plugins/NfsStorage.cxx
View file @
31d77ec5
...
@@ -389,7 +389,7 @@ NfsStorage::OpenDirectory(const char *uri_utf8)
...
@@ -389,7 +389,7 @@ NfsStorage::OpenDirectory(const char *uri_utf8)
static
Storage
*
static
Storage
*
CreateNfsStorageURI
(
EventLoop
&
event_loop
,
const
char
*
base
)
CreateNfsStorageURI
(
EventLoop
&
event_loop
,
const
char
*
base
)
{
{
if
(
mem
cmp
(
base
,
"nfs://"
,
6
)
!=
0
)
if
(
strn
cmp
(
base
,
"nfs://"
,
6
)
!=
0
)
return
nullptr
;
return
nullptr
;
const
char
*
p
=
base
+
6
;
const
char
*
p
=
base
+
6
;
...
...
src/storage/plugins/SmbclientStorage.cxx
View file @
31d77ec5
...
@@ -182,7 +182,7 @@ SmbclientDirectoryReader::GetInfo(gcc_unused bool follow)
...
@@ -182,7 +182,7 @@ SmbclientDirectoryReader::GetInfo(gcc_unused bool follow)
static
Storage
*
static
Storage
*
CreateSmbclientStorageURI
(
gcc_unused
EventLoop
&
event_loop
,
const
char
*
base
)
CreateSmbclientStorageURI
(
gcc_unused
EventLoop
&
event_loop
,
const
char
*
base
)
{
{
if
(
mem
cmp
(
base
,
"smb://"
,
6
)
!=
0
)
if
(
strn
cmp
(
base
,
"smb://"
,
6
)
!=
0
)
return
nullptr
;
return
nullptr
;
SmbclientInit
();
SmbclientInit
();
...
...
test/test_translate_song.cxx
View file @
31d77ec5
...
@@ -34,7 +34,7 @@ Log(const Domain &domain, gcc_unused LogLevel level, const char *msg)
...
@@ -34,7 +34,7 @@ Log(const Domain &domain, gcc_unused LogLevel level, const char *msg)
bool
bool
uri_supported_scheme
(
const
char
*
uri
)
uri_supported_scheme
(
const
char
*
uri
)
{
{
return
mem
cmp
(
uri
,
"http://"
,
7
)
==
0
;
return
strn
cmp
(
uri
,
"http://"
,
7
)
==
0
;
}
}
static
constexpr
auto
music_directory
=
PATH_LITERAL
(
"/music"
);
static
constexpr
auto
music_directory
=
PATH_LITERAL
(
"/music"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment