Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix null check for pre-prompt functions
- X-seq: zsh-workers 49533
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: fix null check for pre-prompt functions
- Date: Fri, 29 Oct 2021 23:49:34 +0200
- Archived-at: <https://zsh.org/workers/49533>
- List-id: <zsh-workers.zsh.org>
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) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author