Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix a string concatenation bug when validating extensions #6246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bierbaum
Copy link
Contributor

As builtin extensions are evaluated in the latter half of check_valid_extension, a string cfg is concatenated with the static string 'extension.' and the value from builtin_extension, before being compared with the configured value. This string is not being cleared while iterating through the names of the extensions. Because there is currently only one extension (noop), the bug was never noticeable.

This patch corrects the behavior by clearing the string on each iteration, as is done in for user extensions in the preceding block.

…ation

As builtin extensions are evaluated in the latter half of `check_valid_extension`, a string `cfg` is concatenated with the static string 'extension.' and the value from `builtin_extension`, before being compared with the configured value. This string is not being cleared while iterating through the names of the extensions. Because there is currently only one extension ('noop'), the bug was never noticible.

This patch corrects the behavior by clearing the string on each iteration, as is done in the first block.
@bierbaum
Copy link
Contributor Author

I noticed this while testing the following patch: https://github.com/vermiculus/libgit2/tree/sallred/support-worktree-config

@ethomson
Copy link
Member

Oops, good catch. Thanks!

@ethomson ethomson merged commit 0e53006 into libgit2:main Mar 23, 2022
@ethomson ethomson added the bug label Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants