Skip to content

Commit

Permalink
RestClientEmscripten: Fix UB in GET/SET
Browse files Browse the repository at this point in the history
Do not take address of temporary.
  • Loading branch information
frankosterfeld authored and RalphSteinhagen committed Feb 5, 2024
1 parent 57f31a1 commit 9e244e5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/client/include/RestClientEmscripten.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ class RestClient : public ClientBase {

private:
void executeCommand(Command &&cmd) const {
auto uri = opencmw::URI<>::factory(cmd.topic).build();
auto preferredHeader = detail::getPreferredContentTypeHeader(cmd.topic, _mimeType);
std::array<const char *, preferredHeader.size() + 1> preferredHeaderEmscripten;
std::transform(preferredHeader.cbegin(), preferredHeader.cend(), preferredHeaderEmscripten.begin(),
Expand Down Expand Up @@ -269,8 +268,8 @@ class RestClient : public ClientBase {

// TODO: Pass the payload as POST body: emscripten_fetch(&attr, uri.relativeRef()->data());

auto d = URI<>::factory(uri).addQueryParameter("_bodyOverride", body).build().str().data();
emscripten_fetch(&attr, d);
const auto uri = URI<>::factory(cmd.topic).addQueryParameter("_bodyOverride", body).build();
emscripten_fetch(&attr, uri.str().data());
}

void startSubscription(Command &&cmd) {
Expand Down

0 comments on commit 9e244e5

Please sign in to comment.