mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 08:59:59 -04:00
[9.20] fix: dev: Fix inverted gethostname() check in rndc status
The replacement of named_os_gethostname() with raw gethostname() inverted the success check: the "localhost" fallback runs on success, and on failure the uninitialized hostname buffer is read by snprintf(), leaking stack memory via the rndc status reply. Closes #5889 Backport of MR !11879 Merge branch 'backport-5889-fix-gethostname-inverted-check-9.20' into 'bind-9.20' See merge request isc-projects/bind9!11881
This commit is contained in:
commit
5ede4a87eb
1 changed files with 1 additions and 1 deletions
|
|
@ -12660,7 +12660,7 @@ named_server_status(named_server_t *server, isc_buffer_t **text) {
|
|||
cb);
|
||||
CHECK(putstr(text, line));
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)) == 0) {
|
||||
if (gethostname(hostname, sizeof(hostname)) != 0) {
|
||||
strlcpy(hostname, "localhost", sizeof(hostname));
|
||||
}
|
||||
snprintf(line, sizeof(line), "running on %s: %s\n", hostname,
|
||||
|
|
|
|||
Loading…
Reference in a new issue