mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-27 12:26:24 +00:00
Fix memset in mg_iotest, add mg_random_str test
This commit is contained in:
1 parent
e30ad43d36
commit
6c796b8552
4 files changed
+19
-6
No files matched your search
+1
-1
@@ -25,7 +25,7 @@ char *mg_random_str(char *buf, size_t len) {
|
||||
size_t i;
|
||||
mg_random(buf, len);
|
||||
for (i = 0; i < len; i++) {
|
||||
uint8_t c = ((uint8_t *) buf)[i] % 62;
|
||||
uint8_t c = ((uint8_t *) buf)[i] % 62U;
|
||||
buf[i] = i == len - 1 ? (char) '\0' // 0-terminate last byte
|
||||
: c < 26 ? (char) ('a' + c) // lowercase
|
||||
: c < 52 ? (char) ('A' + c - 26) // uppercase
|
||||
|
||||
Reference in new issue
Block a user