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

PATCH 03/17: computil: Check for NULL before passing to strlen



The rest of this function appears to be very careful about checking these,
then forgets in this one spot. Found by Coverity (Issue 1255805).
---
 Src/Zle/computil.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index b11c39f..a81d1dd 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -4060,7 +4060,8 @@ cfp_test_exact(LinkList names, char **accept, char *skipped)
     if (sl > PATH_MAX2)
 	return NULL;
 
-    suf = dyncat(skipped, rembslash(dyncat(compprefix, compsuffix)));
+    suf = dyncat(skipped, rembslash(dyncat(compprefix ? compprefix : "",
+		                           compsuffix ? compsuffix : "")));
 
     for (node = firstnode(names); node; incnode(node)) {
 	l = strlen(p = (char *) getdata(node));
-- 
2.2.0.GIT



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