Skip to content

Conversation

@michaelbeale-IL
Copy link
Contributor

Potential fix for https://github.com/IntelLabs/async-toolkit/security/code-scanning/149

The safest, clearest fix is to replace the calls to strncpy(..., strlen(...)+1) on lines 123, 126, and 129 with strcpy(...). This reflects the dynamic allocation that matches the source length, always including the null terminator. We should make this change for all three similar cases for consistency and clarity. No import or further definition changes are required, as strcpy is already available via <string.h>. Only these lines in the code block need modification.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…size in string copy

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

entry->archive=leak_realloc(entry->archive,strlen(archive)+1);
strncpy(entry->archive,archive,strlen(archive)+1);
strcpy(entry->archive,archive);

Check failure

Code scanning / CodeQL

Unbounded write Critical

This 'call to strcpy' with input from
a command-line argument
may overflow the destination.

entry->member=leak_realloc(entry->member,strlen(member)+1);
strncpy(entry->member,member,strlen(member)+1);
strcpy(entry->member,member);

Check failure

Code scanning / CodeQL

Unbounded write Critical

This 'call to strcpy' with input from
a command-line argument
may overflow the destination.
@michaelbeale-IL michaelbeale-IL marked this pull request as ready for review October 31, 2025 00:24
@michaelbeale-IL michaelbeale-IL merged commit 8ca87d6 into main Oct 31, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant