encoding: don't call memcmp() with null pointer
It's undefined behavior.
Change-Id: Id2fd5cbc0483af2bf9857e81fb6cac8163da3474
Refs: #4368
diff --git a/src/name-component.cpp b/src/name-component.cpp
index 5cf31aa..36a01f9 100644
--- a/src/name-component.cpp
+++ b/src/name-component.cpp
@@ -31,6 +31,7 @@
#include "util/string-helper.hpp"
#include <boost/algorithm/string/trim.hpp>
+#include <cstring>
#include <sstream>
namespace ndn {
@@ -387,7 +388,7 @@
{
return type() == other.type() &&
value_size() == other.value_size() &&
- (empty() || // needed on OSX 10.9 due to STL bug
+ (empty() || // needed with Apple clang < 9.0.0 due to libc++ bug
std::equal(value_begin(), value_end(), other.value_begin()));
}
@@ -410,7 +411,7 @@
if (cmpSize != 0)
return cmpSize;
- if (empty()) // needed on OSX 10.9 due to STL bug
+ if (empty())
return 0;
return std::memcmp(value(), other.value(), value_size());