talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit ca7335445eedf0da1b6518846338a7abdecbb7e1
parent 2573f543f6fea2532847112928aa77d8e66d5b5d
Author: Paul <paul@claws-mail.org>
Date:   Tue, 21 Nov 2023 11:40:17 +0000

if cmd is invalid, NULL it

this prevents an execution attempt of an invalid command, and also prevents spewing text content into the debug output, and also prevents it being necessary to hit the Cancel button twice on the 'Open with...' dialogue

Diffstat:
Msrc/mimeview.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mimeview.c b/src/mimeview.c @@ -2265,9 +2265,10 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo, g_chmod(filename, S_IRUSR|S_IWUSR); } else { g_warning("MIME viewer command-line is invalid: '%s'", cmd); + cmd = NULL; mimeview_open_part_with(mimeview, partinfo, FALSE); } - if (execute_command_line(buf, TRUE, NULL) != 0) { + if (cmd != NULL && execute_command_line(buf, TRUE, NULL) != 0) { if (!prefs_common.save_parts_readwrite) g_chmod(filename, S_IRUSR|S_IWUSR); mimeview_open_part_with(mimeview, partinfo, FALSE);