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

use duplicate host function (backport #888) #893

Merged
merged 2 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Deprecated
### Removed
### Fixed
Backport #832. Fix interrupted scan, when the process table is full. [#835](https://github.com/greenbone/openvas-scanner/pull/835)
- Backport #832. Fix interrupted scan, when the process table is full. [#835](https://github.com/greenbone/openvas-scanner/pull/835)
- Fix Segmentation fault when freeing hosts and alive hosts [#893](https://github.com/greenbone/openvas/pull/893)

[20.8.4]: https://github.com/greenbone/openvas-scanner/compare/v20.8.3...openvas-20.08

Expand Down
14 changes: 9 additions & 5 deletions src/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,7 @@ attack_network (struct scan_globals *globals)
if (test_alive_hosts_only)
{
struct in6_addr tmpaddr;
gvm_host_t *buf;

/* Boolean signalling if alive detection finished. */
gboolean ad_finished = FALSE;
Expand All @@ -1289,13 +1290,16 @@ attack_network (struct scan_globals *globals)
fork_sleep (1);
}

if (gvm_host_get_addr6 (host, &tmpaddr) == 0)
host = gvm_host_find_in_hosts (host, &tmpaddr, hosts);

if (host)
if (host && gvm_host_get_addr6 (host, &tmpaddr) == 0)
{
gvm_hosts_add (alive_hosts_list, host);
buf = host;
host = gvm_host_find_in_hosts (host, &tmpaddr, hosts);
gvm_host_free (buf);
buf = NULL;
}

if (host)
gvm_hosts_add (alive_hosts_list, gvm_duplicate_host (host));
else
g_debug ("%s: got NULL host, stop/finish scan", __func__);
}
Expand Down