summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--login.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a79bb19c9..3037eac38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
120000530 120000530
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
420000520 620000520
5 - Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de> 7 - Xauth fix from Markus Friedl <markus.friedl@informatik.uni-erlangen.de>
diff --git a/login.c b/login.c
index 49853bdc2..6749a1556 100644
--- a/login.c
+++ b/login.c
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20#include "includes.h" 20#include "includes.h"
21RCSID("$Id: login.c,v 1.27 2000/05/17 12:00:03 damien Exp $"); 21RCSID("$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) {