aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/StringCompare.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-06 09:24:18 +0100
committerMax Kellermann <max@duempel.org>2015-11-06 09:24:18 +0100
commit42f5ecd4a116c96d30bf407859dadaa9a053ea39 (patch)
tree644ee945bda37afde922b9a3306fd19c3af23200 /src/util/StringCompare.cxx
parent733989a284d2f7cce37634b12afad72cc019f659 (diff)
downloadmpd-42f5ecd4a116c96d30bf407859dadaa9a053ea39.tar.gz
mpd-42f5ecd4a116c96d30bf407859dadaa9a053ea39.tar.xz
mpd-42f5ecd4a116c96d30bf407859dadaa9a053ea39.zip
util/StringCompare: use strncmp() instead of memcmp() in StringStartsWith()
Some optimized implementations of memcmp() may not start from the beginning of the string, and may thus segfault.
Diffstat (limited to '')
-rw-r--r--src/util/StringCompare.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/StringCompare.cxx b/src/util/StringCompare.cxx
index a7e505d12..fbd8e1d6d 100644
--- a/src/util/StringCompare.cxx
+++ b/src/util/StringCompare.cxx
@@ -36,8 +36,8 @@
bool
StringStartsWith(const char *haystack, const char *needle)
{
- const size_t length = strlen(needle);
- return memcmp(haystack, needle, length) == 0;
+ const size_t length = StringLength(needle);
+ return StringIsEqual(haystack, needle, length);
}
bool