diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | login.c | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,7 @@ | |||
1 | 20000530 | 1 | 20000530 |
2 | - Define atexit for old Solaris | 2 | - Define atexit for old Solaris |
3 | - Fix buffer overrun in login.c for systems which use syslen in utmpx. | ||
4 | patch from YOSHIFUJI Hideaki <yoshfuji@cerberus.nemoto.ecei.tohoku.ac.jp> | ||
3 | 5 | ||
4 | 20000520 | 6 | 20000520 |
5 | - Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de> | 7 | - Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de> |
@@ -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) { |