Commit 95637fd1 authored by Max Kellermann's avatar Max Kellermann

lib/upnp/Discovery: use strncmp() instead of memcmp()

memcmp() can overflow the buffer.
parent 5ac72211
...@@ -39,7 +39,7 @@ static bool ...@@ -39,7 +39,7 @@ static bool
isCDService(const char *st) noexcept isCDService(const char *st) noexcept
{ {
constexpr size_t sz = sizeof(ContentDirectorySType) - 3; constexpr size_t sz = sizeof(ContentDirectorySType) - 3;
return memcmp(ContentDirectorySType, st, sz) == 0; return strncmp(ContentDirectorySType, st, sz) == 0;
} }
// The type of device we're asking for in search // The type of device we're asking for in search
...@@ -50,7 +50,7 @@ static bool ...@@ -50,7 +50,7 @@ static bool
isMSDevice(const char *st) noexcept isMSDevice(const char *st) noexcept
{ {
constexpr size_t sz = sizeof(MediaServerDType) - 3; constexpr size_t sz = sizeof(MediaServerDType) - 3;
return memcmp(MediaServerDType, st, sz) == 0; return strncmp(MediaServerDType, st, sz) == 0;
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment