diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2025-04-08 14:27:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-08 14:27:48 -0400 |
commit | a4fb4b69dc05368c8e7f605c6bbaab244fcdd426 (patch) | |
tree | 8c972260225c7104f26d9531676ba77b625c8bfa /src/lib/core/github.c | |
parent | 4b28b550de153ea917b7c8736a4c61f2a42c8028 (diff) | |
parent | d3f943a9606e8d7b992ae3a999fc2c74962e1a0a (diff) | |
download | stasis-master.tar.gz |
Fix garbage after generated release notes
Diffstat (limited to 'src/lib/core/github.c')
-rw-r--r-- | src/lib/core/github.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/core/github.c b/src/lib/core/github.c index c195a28..f0c5199 100644 --- a/src/lib/core/github.c +++ b/src/lib/core/github.c @@ -109,9 +109,12 @@ int get_github_release_notes(const char *api_token, const char *repo, const char if (last_char == ',') { trim++; } - data_offset[strlen(data_offset) - trim] = 0; + // Truncate the trimmed bytes + memset(&data_offset[strlen(data_offset) - trim], 0, trim); // Extract release notes - *output = strdup(data_offset); + *output = calloc(strlen(data_offset) + 1, sizeof(**output)); + // Copy output (including terminator) + strncpy(*output, data_offset, strlen(data_offset) + 1); } else if ((data_offset = strstr(line, field_message))) { // Skip past the message field data_offset += strlen(field_message); |