Skip to content

Commit

Permalink
Merge pull request #893 from Kraemii/fix-duplicate-host
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 5c65fc6 + 7c0533e commit d5377b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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

0 comments on commit d5377b4

Please sign in to comment.