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

Initialize reallocated memory in gvm_hosts_add #520

Merged
merged 7 commits into from
Jun 18, 2021

Conversation

timopollmeier
Copy link
Member

@timopollmeier timopollmeier commented Jun 17, 2021

What:
If the array memory for the hosts is reallocated, the new memory is
initialized with all \0 bytes.

Why:
This ensures the array is correctly terminated when gvm_hosts_fill_gaps
is called when excluding hosts.

How:
By creating multiple targets with very large host ranges (> 2 million hosts) and adding excluded hosts to at least one of them.

Checklist:

If the array memory for the hosts is reallocated, the new memory is
initialized with all \0 bytes.
This ensures the array is correctly terminated when gvm_hosts_fill_gaps
is called when excluding hosts.
@timopollmeier timopollmeier added backport-to-oldstable This pull request will be backported to the 20.08 branch backport-to-stable This pull request will be backported to the 21.04 branch labels Jun 17, 2021
base/hosts.c Outdated Show resolved Hide resolved
base/hosts.c Outdated Show resolved Hide resolved
timopollmeier and others added 3 commits June 17, 2021 14:33
Co-authored-by: Jaspar L. <jstach@uos.de>
The offset must not be multiplied with the pointer size as it is
already implied by the pointer arithmetic.
@timopollmeier timopollmeier marked this pull request as ready for review June 17, 2021 13:54
@timopollmeier timopollmeier requested a review from a team as a code owner June 17, 2021 13:54
@timopollmeier timopollmeier merged commit dbfabc8 into greenbone:master Jun 18, 2021
timopollmeier added a commit to timopollmeier/gvm-libs that referenced this pull request Jun 18, 2021
If the array memory for the hosts is reallocated, the new memory is
initialized with all \0 bytes.
This ensures the array is correctly terminated when gvm_hosts_fill_gaps
is called when excluding hosts.

This is a backport of greenbone#520.
timopollmeier added a commit to timopollmeier/gvm-libs that referenced this pull request Jun 18, 2021
If the array memory for the hosts is reallocated, the new memory is
initialized with all \0 bytes.
This ensures the array is correctly terminated when gvm_hosts_fill_gaps
is called when excluding hosts.

This is a backport of greenbone#520.
@timopollmeier timopollmeier deleted the hosts-fix branch October 15, 2021 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-oldstable This pull request will be backported to the 20.08 branch backport-to-stable This pull request will be backported to the 21.04 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants