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.
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,