__gethostname_chk

Name

__gethostname_chk -- get host name, with buffer overflow checking

Synopsis

#include <unistd.h>

int __gethostname_chk(char * buf, size_t buflen, size_t maxlen);

Description

The interface __gethostname_chk() shall function in the same way as the interface gethostname(), except that __gethostname_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If buflen exceeds maxlen, the function shall abort, and the program calling it shall exit.

The __gethostname_chk() function is not in the source standard; it is only in the binary standard.