Skip to content

Commit

Permalink
Add error check when excluding hosts in CVE scan
Browse files Browse the repository at this point in the history
Co-authored-by: Ahmed <144101267+a-h-abdelsalam@users.noreply.github.com>
  • Loading branch information
timopollmeier and a-h-abdelsalam committed Mar 8, 2024
1 parent f660381 commit ccb000c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -3243,9 +3243,19 @@ fork_cve_scan_handler (task_t task, target_t target)
/* Add the results. */

gvm_hosts = gvm_hosts_new (hosts);
gvm_hosts_exclude (gvm_hosts, exclude_hosts ?: "");

free (hosts);

if (gvm_hosts_exclude (gvm_hosts, exclude_hosts ?: "") < 0)
{
set_task_interrupted (task,
"Failed to exclude hosts."
" Interrupting scan.");
set_report_scan_run_status (global_current_report, TASK_STATUS_INTERRUPTED);
gvm_hosts_free (gvm_hosts);
free (exclude_hosts);
gvm_close_sentry ();
exit(1);
}
free (exclude_hosts);

while ((gvm_host = gvm_hosts_next (gvm_hosts)))
Expand Down

0 comments on commit ccb000c

Please sign in to comment.