From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5657 invoked from network); 29 Oct 2021 21:49:55 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Oct 2021 21:49:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:From:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=b0c0tyoDHahzj2ueYd9HCw4kSB9JQJlkFCoQLGRd9TA=; b=sjgmIo8qBkCGg4IOg3jtusR1pW KKpQ8KUFckQK4hpMasYET6XJZGFHFDciOJqj5+LBrMep+C7Pg4oH13AhS3WknZ/qU6DioOr+05dpf FCiLMvxAaCrDFbaK4h4lOSbJNePWidAB3H1uAKmBf/ifN24v5t9jzxChZuI542ctOzbooAdVMOGrx Ee7//KJ+RWCKcsaex1/h/6kNRigjXcmMsH1+8fnJTfyl2kAItCYFGM1v8J4hXCHimdYb/ODn4Tuf8 L1ROeMRL1ar4UK7258qutYreB3FQ3COHkArchMyHoEYwqLjGSm/nsCOxW565BvtkboR1RI8YY20Jz lAHc2CrQ==; Received: from authenticated user by zero.zsh.org with local id 1mgZl2-0007Oe-UB; Fri, 29 Oct 2021 21:49:52 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mgZkn-00076g-8K; Fri, 29 Oct 2021 21:49:37 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1mgZkk-000AfL-8N for zsh-workers@zsh.org; Fri, 29 Oct 2021 23:49:34 +0200 From: Oliver Kiddle To: Zsh workers Subject: PATCH: fix null check for pre-prompt functions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <41001.1635544174.1@hydra> Date: Fri, 29 Oct 2021 23:49:34 +0200 Message-ID: <41002-1635544174.228872@V09W.Ajya.BPpf> X-Seq: 49533 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: The following results in a null dereference: zmodload -F zsh/sched -CRAP The cause being that the schedd cleanup_ function is called even though the initialisation failed before it got as far as initialising the linked list of pre-prompt functions. This adds a check. Oliver diff --git a/Src/utils.c b/Src/utils.c index a74c8bd2c..ed3690172 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -1378,6 +1378,9 @@ delprepromptfn(voidvoidfnptr_t func) { LinkNode ln; + if (!prepromptfns) + return; + for (ln = firstnode(prepromptfns); ln; ln = nextnode(ln)) { Prepromptfn ppdat = (Prepromptfn)getdata(ln); if (ppdat->func == func) {