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

Initialize reallocated memory in gvm_hosts_add #520

Merged
merged 7 commits into from
Jun 18, 2021
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 @@ -89,6 +89,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Adding initialization to struct scanner in `boreas/util_tests.c`. [#438](https://github.com/greenbone/gvm-libs/pull/438)
- Fix warnings about uninitialized variables. [#448](https://github.com/greenbone/gvm-libs/pull/448)
- Split the log message into smaller pieces when syslog is the log destination. [#455](https://github.com/greenbone/gvm-libs/pull/455)
- Initialize reallocated memory in gvm_hosts_add [#520](https://github.com/greenbone/gvm-libs/pull/520)

### Removed

Expand Down
2 changes: 2 additions & 0 deletions base/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,8 @@ gvm_hosts_add (gvm_hosts_t *hosts, gvm_host_t *host)
hosts->max_size *= 4;
hosts->hosts =
g_realloc_n (hosts->hosts, hosts->max_size, sizeof (*hosts->hosts));
memset (hosts->hosts + hosts->count, '\0',
(hosts->max_size - hosts->count) * sizeof (gvm_host_t *));
}
hosts->hosts[hosts->count] = host;
hosts->count++;
Expand Down