diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-04-08 11:05:39 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2025-04-08 11:05:39 -0400 |
commit | 9abde809187b88f66e82ec6106b2d03ccbb4d57d (patch) | |
tree | afec9206c72a829603771dbe530ee60f3ca8d8a5 | |
parent | 90755c85131cceb9f6d628703042129dc10dfca9 (diff) | |
download | stasis-9abde809187b88f66e82ec6106b2d03ccbb4d57d.tar.gz |
Bug fix: Prevents garbage at the end of generated release notes
-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); |