Fix: check the result iterator init in print_report_port_xml - #3151
Merged
greenbonebot merged 2 commits intoSep 23, 2026
Conversation
print_report_port_xml ignored the return of init_result_get_iterator and then ran next() on the iterator, which is uninitialised when the init fails before touching it (eg the filter referred to by get->filt_id was deleted between the validation and the init). Return when the init fails, leaving a valid empty iterator for the caller to clean up.
greenbonebot
enabled auto-merge (rebase)
September 22, 2026 19:41
ozgen
reviewed
Sep 23, 2026
ozgen
approved these changes
Sep 23, 2026
…or-when-init-result-get-iterator-fails
greenbonebot
deleted the
fix/89-use-of-an-uninitialised-result-iterator-when-init-result-get-iterator-fails
branch
September 23, 2026 13:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In
print_report_port_xml, checkinit_result_get_iteratorand, when itfails, return without using the iterator, leaving a valid empty iterator for
the caller to clean up.
Why
print_report_port_xmlignoredinit_result_get_iterator's return and thenran
nexton the iterator. When the init failed before touching the iterator,then
nextand the caller'scleanup_iteratorused uninitialised stack memory.Testing
Before the change, an authenticated
for a report with ports, whose filter
Fwas deleted between the request'sfilter validation and the port-iterator init, made gvmd dereference
the uninitialised iterator and abort:
After the change the same request returns with no ASan report.