Skip to content
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

Fix segfault in Done button of downloads #197

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

rodarima
Copy link
Member

@rodarima rodarima commented Jun 12, 2024

The destructor was using a harcoded index to the elements to free from the original array of arguments used to call the wget program. When the user agent was introduced, the index of the elements that require free() shifted, causing the free() call to operate on the constant string of the user agent instead.

Rather than relying on the hardcoded index, two new pointers hold the values of the strings that need to be free()'d in the destructor. Further additions in the argument array won't cause more problems.

Reported-by: pastebin
Fixes: #196
See: https://lists.mailman3.com/hyperkitty/list/[email protected]/message/IPWQYKTYTO5G2BH3UU5224FRUFWCVGSO/

The destructor was using a harcoded index to the elements to free from
the original array of arguments used to call the wget program. When the
user agent was introduced, the index of the elements that require free()
shifted, causing the free() call to operate on the constant string of
the user agent instead.

Rather than relying on the hardcoded index, two new pointers hold the
values of the strings that need to be free()'d in the destructor.
Further additions in the argument array won't cause more problems.

Reported-by: pastebin <[email protected]>
Fixes: #196
See: https://lists.mailman3.com/hyperkitty/list/[email protected]/message/IPWQYKTYTO5G2BH3UU5224FRUFWCVGSO/
@rodarima rodarima added this to the Release 3.2.0 milestone Jun 12, 2024
@rodarima rodarima merged commit 5db6c99 into master Jun 12, 2024
20 checks passed
@rodarima rodarima deleted the fix-segfault-downloads-done-button branch June 12, 2024 19:36
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.

Segfault when clicking the Done button on downloads dialog
1 participant