rfelker writes in Bug 742: make sure string is null terminated after calling gethostname

This commit is contained in:
Mike Frysinger 2006-02-19 23:03:31 +00:00
parent 294254ce6b
commit dce17c6268

View File

@ -96,6 +96,7 @@ void print_login_issue(const char *issue_file, const char *tty)
case 'h': case 'h':
gethostname(buf, sizeof(buf) - 1); gethostname(buf, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
break; break;
case 'l': case 'l':
@ -105,7 +106,7 @@ void print_login_issue(const char *issue_file, const char *tty)
default: default:
buf[0] = c; buf[0] = c;
} }
} }
fputs(outbuf, stdout); fputs(outbuf, stdout);
} }