zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix null check for pre-prompt functions
@ 2021-10-29 21:49 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2021-10-29 21:49 UTC (permalink / raw)
  To: Zsh workers

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) {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-29 21:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 21:49 PATCH: fix null check for pre-prompt functions Oliver Kiddle

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).