diff options
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | redfish-core/lib/log_services.hpp | 13 |
2 files changed, 4 insertions, 10 deletions
diff --git a/.clang-tidy b/.clang-tidy index c15af94606..7f36b77c1f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -211,6 +211,7 @@ cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-type-cstyle-cast, cppcoreguidelines-pro-type-member-init, cppcoreguidelines-pro-type-reinterpret-cast, +cppcoreguidelines-pro-type-static-cast-downcast, cppcoreguidelines-pro-type-vararg, cppcoreguidelines-special-member-functions, misc-misplaced-const, diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index a33e0612b9..774bb0a272 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -2856,16 +2856,9 @@ inline void requestRoutesCrashdumpFile(App& app) return; } ifs.seekg(0, std::ios::beg); - - auto crashData = std::make_unique<char[]>( - static_cast<unsigned int>(fileSize)); - - ifs.read(crashData.get(), static_cast<int>(fileSize)); - - // The cast to std::string is intentional in order to - // use the assign() that applies move mechanics - asyncResp->res.body().assign( - static_cast<std::string>(crashData.get())); + size_t sFileSize = static_cast<size_t>(fileSize); + asyncResp->res.body().resize(sFileSize, '\0'); + ifs.read(asyncResp->res.body().data(), fileSize); // Configure this to be a file download when accessed // from a browser |