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

Validate for max_scan_hosts scanner preference. #482

Merged
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Add function ldap_enable_debug () [#453](https://github.com/greenbone/gvm-libs/pull/453)
- Ensure that new kb taken by the scanner are always clean. [#469](https://github.com/greenbone/gvm-libs/pull/469)
- Validate for max_scan_hosts scanner preference. [#482](https://github.com/greenbone/gvm-libs/pull/482)

### Changed
Use a char pointer instead of an zero-lenght array as kb_redis struct member. [443](https://github.com/greenbone/gvm-libs/pull/443)
Expand Down
14 changes: 12 additions & 2 deletions boreas/alivedetection.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,19 @@ alive_detection_init (gvm_hosts_t *hosts, alive_test_t alive_test)

/* Scan restrictions. max_scan_hosts related. */
const gchar *pref_str;
int max_scan_hosts = INT_MAX;
int max_scan_hosts = INT_MAX, pref_value;

/* Check that the max_scan_hosts is set and it is greater than 0 */
if ((pref_str = prefs_get ("max_scan_hosts")) != NULL)
max_scan_hosts = atoi (pref_str);
{
pref_value = atoi (pref_str);
if (pref_value > 0)
max_scan_hosts = pref_value;
else
g_debug ("%s: Invalid max_scan_hosts value. It must be an interger "
"greater than zero.",
__func__);
}

init_scan_restrictions (&scanner, max_scan_hosts);

Expand Down