From: Ulrich Drepper Date: Thu, 28 Feb 2002 20:12:50 +0000 (+0000) Subject: (login): Always initialize ut_line field. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f950c64846a052cd9629d94a19194a53a8c5e94;p=thirdparty%2Fglibc.git (login): Always initialize ut_line field. --- diff --git a/login/login.c b/login/login.c index a7a3ff5afa2..6efa7627f43 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 , 1996. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #include #include @@ -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, ©);