From e05778a4e4c2dd85776f6b6f85ac51a19a9cd326 Mon Sep 17 00:00:00 2001 From: "Stan. S. Krupoderov" Date: Fri, 4 Sep 2009 09:49:51 +0400 Subject: [PATCH] Ticket #1580: mc segfaults when you try to use non-anonymous FTP wtools.c: fix init of def_text for INPUT_PASSWORD special value Signed-off-by: Stan. S. Krupoderov --- src/wtools.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/wtools.c b/src/wtools.c index 3275c334f..7f3279c7e 100644 --- a/src/wtools.c +++ b/src/wtools.c @@ -1,7 +1,7 @@ /* Widget based utility functions. Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. - + Authors: 1994, 1995, 1996 Miguel de Icaza 1994, 1995 Radek Doulik 1995 Jakub Jelinek @@ -456,7 +456,7 @@ quick_dialog (QuickDialog *qd) * The argument "history_name" holds the name of a section * in the history file. Data entered in the input field of * the dialog box will be stored there. - * + * */ static char * fg_input_dialog_help (const char *header, const char *text, const char *help, @@ -464,6 +464,11 @@ fg_input_dialog_help (const char *header, const char *text, const char *help, { char *my_str; + /* The special value of def_text is used to identify password boxes */ + if (def_text == INPUT_PASSWORD) { + def_text = ""; + } + QuickWidget quick_widgets[] = { /* 0 */ QUICK_BUTTON (6, 10, 1, 0, N_("&Cancel"), B_CANCEL, NULL), /* 1 */ QUICK_BUTTON (3, 10, 1, 0, N_("&OK"), B_ENTER, NULL), @@ -492,7 +497,6 @@ fg_input_dialog_help (const char *header, const char *text, const char *help, if (def_text == INPUT_PASSWORD) { quick_widgets[2].u.input.flags = 1; histname[3] = '\0'; - def_text = ""; } #ifdef ENABLE_NLS @@ -570,7 +574,7 @@ char *input_dialog (const char *header, const char *text, } char * -input_expand_dialog (const char *header, const char *text, +input_expand_dialog (const char *header, const char *text, const char *history_name, const char *def_text) { char *result;