Skip to content

Commit

Permalink
Get rid of useless move when assigning echRandom
Browse files Browse the repository at this point in the history
Summary:
The `Random` is simply a std::array<unsigned char, 32>. `std::move(...)`
doesn't do anything special here other than a copy.

Remove the `std::move()` when assigning echRandom, as this confuses linters
into believing a use-after-move has taken place later on in
`constructEncryptedClientHello`.

Reviewed By: zxjtan

Differential Revision: D66211653

fbshipit-source-id: 0b0e4c2f96103ff5c698e9bdd915278ce35ab3a8
  • Loading branch information
Mingtao Yang authored and facebook-github-bot committed Nov 20, 2024
1 parent a78ce20 commit 3e6fb1c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fizz/client/ClientProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,7 @@ EventHandler<ClientTypes, StateEnum::Uninitialized, Event::Connect>::handle(
folly::Optional<ClientPresharedKey> greasePsk;

if (echParams.has_value()) {
// Swap out randoms first.
echRandom = std::move(random);
echRandom = random;
context->getFactory()->makeRandomBytes(random.data(), random.size());

// Generate GREASE PSK (if needed)
Expand Down

0 comments on commit 3e6fb1c

Please sign in to comment.