diff options
author | Brendan Coles <bcoles@gmail.com> | 2020-11-15 02:27:43 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-15 09:38:35 +0100 |
commit | b31b666301f82bf0a958589dfaab5673b79cccc9 (patch) | |
tree | 7a7d69e39205331afe909b1e68c3a1de079b87e9 | |
parent | be73f9f5443882a5bc8e64990dca85530604b099 (diff) | |
download | serenity-b31b666301f82bf0a958589dfaab5673b79cccc9.zip |
LibC: Ensure mkstemp generates a pattern 6 characters in length
-rw-r--r-- | Libraries/LibC/stdlib.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibC/stdlib.cpp b/Libraries/LibC/stdlib.cpp index b65455214b..9e91be3061 100644 --- a/Libraries/LibC/stdlib.cpp +++ b/Libraries/LibC/stdlib.cpp @@ -186,7 +186,7 @@ __attribute__((warn_unused_result)) int __generate_unique_filename(char* pattern for (int attempt = 0; attempt < 100; ++attempt) { for (int i = 0; i < 6; ++i) - pattern[start + i] = random_characters[(rand() % sizeof(random_characters))]; + pattern[start + i] = random_characters[(rand() % (sizeof(random_characters) - 1))]; struct stat st; int rc = lstat(pattern, &st); if (rc < 0 && errno == ENOENT) |