diff options
author | deraadt <deraadt> | 2015-01-11 04:14:40 +0000 |
---|---|---|
committer | deraadt <deraadt> | 2015-01-11 04:14:40 +0000 |
commit | 8a8e2eb04aa03bd1b8f4a515fc1d7e50a35acb44 (patch) | |
tree | fed919d96281e2ff192a51758a70e9cb947b55ca /format.c | |
parent | aae2b7aa89b80ec6b07a8036f923dc6c8882cfae (diff) |
correctly use HOST_NAME_MAX.
Some notes:
POSIX HOST_NAME_MAX doesn't include the NUL.
POSIX LOGIN_NAME_MAX and TTY_NAME_MAX do include the NUL.
BSD MAXHOSTNAMELEN includes the NUL. Actually, most of the historical
BSD MAX* defines did include the NUL, except for the historical
mistake of utmp fields without NULs in the string, which directly led
to strncpy.. just showing how error prone this kind of accounting is.
CSRG did right. Somehow POSIX missed the memo on the concepts of
carefulness and consistancy, and we are still paying the price when
people trip over this. Of course, glibc is even more amazing (that is
a hint to blackhats)
ok guenther
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -133,7 +133,7 @@ struct format_tree * format_create(void) { struct format_tree *ft; - char host[MAXHOSTNAMELEN], *ptr; + char host[HOST_NAME_MAX+1], *ptr; ft = xcalloc(1, sizeof *ft); RB_INIT(&ft->tree); |