Skip to content

Commit

Permalink
Merge pull request #894 from Kraemii/backport-888-21.04
Browse files Browse the repository at this point in the history
use duplicate host function (backport #888)
  • Loading branch information
y0urself committed Oct 11, 2021
2 parents 2e23a7d + 2618855 commit fa0267d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Backport [#853](https://github.com/greenbone/openvas/pull/853)
- Backport [#862](https://github.com/greenbone/openvas/pull/862)
- Add `find_all` to eregmatch() nasl function [#875](https://github.com/greenbone/openvas/pull/875)
- Fix Segmentation fault when freeing hosts and alive hosts [#888](https://github.com/greenbone/openvas/pull/888)

### Changed
- Changed defaults for installation locations [#826](https://github.com/greenbone/openvas-scanner/pull/826)
Expand Down
14 changes: 9 additions & 5 deletions src/attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,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 @@ -1383,13 +1384,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

0 comments on commit fa0267d

Please sign in to comment.