Skip to content

Commit

Permalink
Merge pull request #482 from jjnicola/max-scan-host-validation
Browse files Browse the repository at this point in the history
Validate for max_scan_hosts scanner preference.
  • Loading branch information
ArnoStiefvater authored Apr 27, 2021
2 parents aa3bba1 + 312e936 commit 758756a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit 758756a

Please sign in to comment.