Skip to content

Commit

Permalink
Simplify loop to write bytes to password
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
  • Loading branch information
claucambra authored and backportbot-nextcloud[bot] committed Jul 20, 2023
1 parent 412c521 commit 637ff51
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/gui/filedetails/sharemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ QString createRandomPassword()

RAND_bytes(unsignedCharArray.data(), numChars);

for (auto i = 0; i < numChars; i++) {
auto byte = unsignedCharArray[i];
byte %= asciiRange + 1;
byte += asciiMin;
for (const auto newChar : unsignedCharArray) {
// Ensure byte is within asciiRange
const auto byte = (newChar % (asciiRange + 1)) + asciiMin;
passwd.append(byte);
}

Expand Down

0 comments on commit 637ff51

Please sign in to comment.