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 #888

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Use fchmod to change file permission instead of on open to prevent race conditions [860](https://github.com/greenbone/openvas-scanner/pull/860)
- Fix plugins upload. Backport #878. [#879](https://github.com/greenbone/openvas/pull/879)
- Fix Segmentation fault when freeing hosts and alive hosts [#888](https://github.com/greenbone/openvas/pull/888)

## [21.10] (unreleased)

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

while (1)
{
Expand Down Expand Up @@ -1231,13 +1232,16 @@ attack_network (struct scan_globals *globals)
break;
}

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