Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Phi Debian Newsgroups: gnu.bash.bug Subject: Patch: command_not_found_handle() flaw Date: Tue, 10 Mar 2020 18:39:04 +0100 Lines: 40 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: usenet.stanford.edu 1583861960 23917 209.51.188.17 (10 Mar 2020 17:39:20 GMT) X-Complaints-To: action@cs.stanford.edu To: Bug reports for the GNU Bourne Again SHell Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=877ToWVTGuIP9G5/pe/0DoZQIrO99lgKZC1b35oYV5A=; b=i9pAksMTLgF8ne3BXgeGvsnMdswvUaobmafqKNSlXdHrOCrp5bTYg9hgBLtmXyTguo L3dy0nkYkhUcFOuo58cMPZds6J2g/FmLSVT34gjQ6edYzkc09qFtqZkXPMuBEsU5aGeg XDwk5Jcgz2fj7b8v9RTE6D8rC/RDAuOKe3X8IR4V0CY7TWqgO3tBp5xWp0LsqLI7U8SN EYx1F+SYk0rRyCU0SmtupW7IFQ4Zym6pZmMwWFC5gKSoXT/qwDv/36dxRga3GDuXhpzB Qpc71P0A3gXF5mLHhL/GgLvwPDk5E15qlhZg8dbN0Ji1ivRT323FmIdDPGGT2rwxziM9 W0GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=877ToWVTGuIP9G5/pe/0DoZQIrO99lgKZC1b35oYV5A=; b=Y6N2UmKlToLGd8mqiIdUN2ihwomIDZBhuF4gIzwO93Ym1EOO+0N+dVoXxY+h+Cn9J6 oOQzf4YeksklGCx31y550NGo2auoYmTnMBPZv4rCGR35iqYRQoQv2VS05bxhNNeNmw1q +buGneV7TUmfSo7+hcB07OPvlhKaakY+UOCR1k2uhlf7vQBr6w5zE33sbsycE9PAA75p Dvz1UsEqUD7LQZKU5kMr26DpauOgHfbn6NYiCB7aFOwbQ/e5bAJSfKvWirzytY0zodOZ YBZ2XCouQhNb7bpMcSlPoBlKuy5/WdSt93zT2DV4PozJGMpoHhu8tpqUEAEf6TPUCxTM /rZg== X-Gm-Message-State: ANhLgQ3MTXAYnXkbixLkK20dCMhO4q+QtiDHE4sMfDBLwrrEK5ST5Hwj KrJgzREHfLYHsEu45lzkPi8UMWhs8ejavIlfmY4DNA== X-Google-Smtp-Source: ADFU+vtw5IbsDPZobrqy98n/WQs0u4UJDHKh3ZTXMwYan+1HD46ZQWPQnjD5Asulgxj2DTO0kFdmar6K0q9fO0Kw/Ys= X-Received: by 2002:a0c:e98c:: with SMTP id z12mr10532232qvn.64.1583861955923; Tue, 10 Mar 2020 10:39:15 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f33 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16008 diff --git a/execute_cmd.c b/execute_cmd.c index 3864986d..ef32631a 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -5370,6 +5370,20 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, command = search_for_command (pathname, CMDSRCH_HASH|(stdpath ? CMDSRCH_STDPATH : 0)); QUIT; + +#define PHI_CNF 1 +#if(PHI_CNF) + if (command == 0) + { hookf = find_function (NOTFOUND_HOOK); + if(hookf) + { wl = make_word_list (make_word (NOTFOUND_HOOK), words); + result=execute_shell_function (hookf, wl); + wl->next=0; + dispose_words(wl); + goto parent_return; + } + } +#endif // PHI_CNF if (command) { @@ -5448,7 +5462,10 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, if (command == 0) { +#if(!PHI_CNF) + // with PHI_CNF==1 hookf==0 hookf = find_function (NOTFOUND_HOOK); +#endif if (hookf == 0) { /* Make sure filenames are displayed using printable characters */