summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-28 20:15:06 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-28 20:15:06 +0000
commit1eb610d162de8470b53b3e31629932ca7726a142 (patch)
tree676231069c8a5ced89cdb495e8bd7010fa1ae53a /login
parent9321beea94daa4b9679099e0fc092ab1845a507d (diff)
downloadglibc-1eb610d162de8470b53b3e31629932ca7726a142.tar.gz
glibc-1eb610d162de8470b53b3e31629932ca7726a142.tar.xz
glibc-1eb610d162de8470b53b3e31629932ca7726a142.zip
Update.
2002-02-28  Ulrich Drepper  <drepper@redhat.com>

	* login/login.c (login): Always initialize ut_line field
	[PR libc/2991].
Diffstat (limited to 'login')
-rw-r--r--login/login.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/login/login.c b/login/login.c
index a7a3ff5afa..6efa7627f4 100644
--- a/login/login.c
+++ b/login/login.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <limits.h>
 #include <string.h>
@@ -133,6 +134,10 @@ login (const struct utmp *ut)
       if (tty != _tty)
 	free (tty);		/* Free buffer malloced by tty_name.  */
     }
+  else
+    /* We provide a default value so that the output does not contain
+       an random bytes in this field.  */
+    strncpy (copy.ut_line, "???", UT_LINESIZE);
 
   /* Update the WTMP file.  Here we have to add a new entry.  */
   updwtmp (_PATH_WTMP, &copy);