Skip to content

Commit 600daff

Browse files
committed
Fix unsafe usage of boost::as_literal, caught by memory sanitiser
1 parent 4be4eae commit 600daff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

boost/network/uri/uri.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ inline bool operator==(const uri::string_type &lhs, const uri &rhs) {
310310
}
311311

312312
inline bool operator==(const uri &lhs, const uri::value_type *rhs) {
313-
return boost::equal(lhs, boost::as_literal(rhs));
313+
auto rlen = strlen(rhs);
314+
auto llen = std::distance(lhs.begin(), lhs.end());
315+
if (rlen != std::abs(llen)) return false;
316+
return boost::equal(lhs, boost::make_iterator_range(rhs, rhs + rlen));
314317
}
315318

316319
inline bool operator==(const uri::value_type *lhs, const uri &rhs) {

0 commit comments

Comments
 (0)