Skip to content

Commit

Permalink
Merge pull request #2056 from greenbone/fix-task-severity
Browse files Browse the repository at this point in the history
Fix: Handle missing report getting task severity
  • Loading branch information
timopollmeier authored Aug 10, 2023
2 parents d80473b + 91aebae commit f155ae5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -18861,13 +18861,12 @@ task_severity_double (task_t task, int overrides, int min_qod, int offset)
|| task_target (task) == 0 /* Container task. */)
return SEVERITY_MISSING;

sql_int64 (&report,
"SELECT id FROM reports"
" WHERE reports.task = %llu"
" AND reports.scan_run_status = %u"
" ORDER BY reports.creation_time DESC"
" LIMIT 1 OFFSET %d",
task, TASK_STATUS_DONE, offset);
report = sql_int64_0 ("SELECT id FROM reports"
" WHERE reports.task = %llu"
" AND reports.scan_run_status = %u"
" ORDER BY reports.creation_time DESC"
" LIMIT 1 OFFSET %d",
task, TASK_STATUS_DONE, offset);

return report_severity (report, overrides, min_qod);
}
Expand Down Expand Up @@ -24694,6 +24693,9 @@ report_severity (report_t report, int overrides, int min_qod)
double severity;
iterator_t iterator;

if (report == 0)
return SEVERITY_MISSING;

init_iterator (&iterator,
"SELECT max(severity)"
" FROM report_counts"
Expand Down

0 comments on commit f155ae5

Please sign in to comment.