mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Fix inverted gethostname() check in rndc status
When named_os_gethostname() was replaced with raw gethostname(), the
success/failure polarity was flipped: the fallback to "localhost" now
runs on success and the hostname buffer is left uninitialized on
failure. In the failure path, snprintf() then reads the uninitialized
stack buffer, disclosing stack contents via the rndc status reply.
(cherry picked from commit f7859247df)
This commit is contained in:
parent
02cdc61f5b
commit
1a4ec35e84
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