From d02f076a54bc3ebbebde232a7ea45df192b4a668 Mon Sep 17 00:00:00 2001 From: Frank Bielig Date: Mon, 4 Nov 2024 12:01:46 +0100 Subject: [PATCH] Fix LTO linker warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `warning: ‘__builtin_strlen’ reading 1 or more bytes from a region of size 0 [-Wstringop-overread]` Signed-off-by: Frank Bielig --- include/osmium/builder/osm_object_builder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osmium/builder/osm_object_builder.hpp b/include/osmium/builder/osm_object_builder.hpp index c3228ca7..afa70894 100644 --- a/include/osmium/builder/osm_object_builder.hpp +++ b/include/osmium/builder/osm_object_builder.hpp @@ -470,7 +470,7 @@ namespace osmium { * @pre @code strlen(user) < 2^16 - 1 @endcode */ TDerived& set_user(const char* user) { - const auto len = std::strlen(user); + const auto len = (user == nullptr) ? 0 : std::strlen(user); assert(len < std::numeric_limits::max()); return set_user(user, static_cast(len)); }