diff --git a/CMakeLists.txt b/CMakeLists.txt index 8684cc519..08c910aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,11 +157,15 @@ if(WITH_APP_BUNDLE) endif() add_gcc_compiler_flags("-fno-common") -add_gcc_compiler_flags("-Wall -Werror -Wextra -Wundef -Wpointer-arith -Wno-long-long") +add_gcc_compiler_flags("-Wall -Wextra -Wundef -Wpointer-arith -Wno-long-long") add_gcc_compiler_flags("-Wformat=2 -Wmissing-format-attribute") add_gcc_compiler_flags("-fvisibility=hidden") add_gcc_compiler_cxxflags("-fvisibility-inlines-hidden") +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_gcc_compiler_flags("-Werror") +endif() + if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8.999) OR CMAKE_COMPILER_IS_CLANGXX) add_gcc_compiler_flags("-fstack-protector-strong") else() diff --git a/src/http/Server.cpp b/src/http/Server.cpp index 6a9cd94b1..08c5b20bf 100644 --- a/src/http/Server.cpp +++ b/src/http/Server.cpp @@ -140,7 +140,11 @@ void Server::generatePassword(const Request &r, Response *protocolResp) protocolResp->setVerifier(key); protocolResp->setEntries(QList() << Entry("generate-password", bits, password, "generate-password")); - memset(password.data(), 0, password.length()); + int size = password.capacity(); + volatile auto* mem = reinterpret_cast(password.data()); + while (size--) { + *mem++ = 0; + } } void Server::handleRequest(const QByteArray& data, QHttpResponse* response)