From 13e1e7e1e94fb2102986e826765c7801f6cd8332 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Tue, 6 May 2014 12:07:16 +0200 Subject: [PATCH] Fix NULL dereference when function name is not specified It was possible to type `function ""; end`, and this caused fish to crash because of NULL pointer. --- builtin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin.cpp b/builtin.cpp index 741dbd4ad..fadd5a4a1 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -2002,6 +2002,7 @@ int define_function(parser_t &parser, const wcstring_list_t &c_args, const wcstr else if (! wcslen(argv[woptind])) { append_format(*out_err, _(L"%ls: No function name given\n"), argv[0]); + res=1; } else {