diff options
Diffstat (limited to 'login.c')
-rw-r--r-- | login.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -18,7 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "includes.h" | 20 | #include "includes.h" |
21 | RCSID("$Id: login.c,v 1.27 2000/05/17 12:00:03 damien Exp $"); | 21 | RCSID("$Id: login.c,v 1.28 2000/05/30 03:12:46 damien Exp $"); |
22 | 22 | ||
23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) | 23 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
24 | # include <utmpx.h> | 24 | # include <utmpx.h> |
@@ -217,10 +217,13 @@ record_login(pid_t pid, const char *ttyname, const char *user, uid_t uid, | |||
217 | # ifdef HAVE_HOST_IN_UTMPX | 217 | # ifdef HAVE_HOST_IN_UTMPX |
218 | # ifdef HAVE_SYSLEN_IN_UTMPX | 218 | # ifdef HAVE_SYSLEN_IN_UTMPX |
219 | utx.ut_syslen = strlen(host); | 219 | utx.ut_syslen = strlen(host); |
220 | if (utx.ut_syslen + 1 > sizeof(utx.ut_host)) | ||
221 | utx.ut_syslen = sizeof(utx.ut_host); | ||
220 | strncpy(utx.ut_host, host, utx.ut_syslen); | 222 | strncpy(utx.ut_host, host, utx.ut_syslen); |
221 | # else | 223 | # else |
222 | strncpy(utx.ut_host, host, sizeof(utx.ut_host)); | 224 | strncpy(utx.ut_host, host, sizeof(utx.ut_host)); |
223 | # endif /* HAVE_SYSLEN_IN_UTMPX */ | 225 | # endif /* HAVE_SYSLEN_IN_UTMPX */ |
226 | utx.ut_host[sizeof(utx.ut_host)-1] = '\0'; | ||
224 | # endif | 227 | # endif |
225 | #if defined(HAVE_ADDR_IN_UTMPX) | 228 | #if defined(HAVE_ADDR_IN_UTMPX) |
226 | if (addr) { | 229 | if (addr) { |