Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] mkenvstr: avoid crash in case NULL is given as value



The crash happens while running a syntax check in ksh emulation mode:

    ln -s /bin/zsh ksh
    echo > script.sh
    ./ksh -n script.sh

Originally reported at <https://bugzilla.redhat.com/1222867>.
---
 Src/params.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Src/params.c b/Src/params.c
index 045ac1e..1df97c6 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -4582,6 +4582,8 @@ mkenvstr(char *name, char *value, int flags)
 {
     char *str, *s;
     int len_name, len_value;
+    if (!value)
+	return NULL;
 
     len_name = strlen(name);
     for (len_value = 0, s = value;
-- 
2.4.1



Messages sorted by: Reverse Date, Date, Thread, Author