Skip to content
Snippets Groups Projects
Commit c6f77675 authored by Robbie Shade's avatar Robbie Shade
Browse files

Explicitly add terminating null character.

parent 61aed92b
No related branches found
No related tags found
No related merge requests found
...@@ -102,9 +102,10 @@ static gpr_slice generate_random_slice() { ...@@ -102,9 +102,10 @@ static gpr_slice generate_random_slice() {
size_t i; size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890"; static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
char output[1024 * 1024]; /* 1 MB */ char output[1024 * 1024]; /* 1 MB */
for (i = 0; i < 1024 * 1024; ++i) { for (i = 0; i < 1024 * 1024 - 1; ++i) {
output[i] = chars[rand() % (int)(sizeof(chars) - 1)]; output[i] = chars[rand() % (int)(sizeof(chars) - 1)];
} }
output[1024 * 1024 - 1] = '\0';
return gpr_slice_from_copied_string(output); return gpr_slice_from_copied_string(output);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment