From fb26f178f94357cdbd2f969ff8c6a06f9edbf341 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Tue, 11 Apr 2000 00:18:38 +0000 Subject: [PATCH] (login): initialize tmp before calling fgets git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8163 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/ftp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c index 613ef2172..ce3e6eb39 100644 --- a/appl/ftp/ftp/ftp.c +++ b/appl/ftp/ftp/ftp.c @@ -190,8 +190,9 @@ login (char *host) printf ("Name (%s:%s): ", host, myname); else printf ("Name (%s): ", host); - fgets (tmp, sizeof (tmp) - 1, stdin); - tmp[strlen (tmp) - 1] = '\0'; + *tmp = '\0'; + if (fgets (tmp, sizeof (tmp) - 1, stdin) != NULL) + tmp[strlen (tmp) - 1] = '\0'; if (*tmp == '\0') user = myname; else