aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-13 21:02:33 +0100
committerMax Kellermann <max@duempel.org>2015-11-13 21:02:33 +0100
commita6bb3cf60a219222bd04164213fb91e013ca78fa (patch)
tree6f18ea4821f59578cff4e6849ae17e5ac8b53c5d
parent004da5d3858ba7215e2a294592fabeaeb374e693 (diff)
downloadmpd-a6bb3cf60a219222bd04164213fb91e013ca78fa.tar.gz
mpd-a6bb3cf60a219222bd04164213fb91e013ca78fa.tar.xz
mpd-a6bb3cf60a219222bd04164213fb91e013ca78fa.zip
command/queue: use StringIsEqual() instead of memcmp()
memcmp() can overflow the buffer.
-rw-r--r--src/command/QueueCommands.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx
index 141c5170a..1d02c8191 100644
--- a/src/command/QueueCommands.cxx
+++ b/src/command/QueueCommands.cxx
@@ -34,6 +34,7 @@
#include "Partition.hxx"
#include "BulkEdit.hxx"
#include "util/ConstBuffer.hxx"
+#include "util/StringAPI.hxx"
#include "util/UriUtil.hxx"
#include "util/NumberParser.hxx"
#include "util/Error.hxx"
@@ -85,7 +86,7 @@ CommandResult
handle_add(Client &client, Request args, Response &r)
{
const char *uri = args.front();
- if (memcmp(uri, "/", 2) == 0)
+ if (StringIsEqual(uri, "/"))
/* this URI is malformed, but some clients are buggy
and use "add /" to add the whole database, which
was never intended to work, but once did; in order