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

PATCH: hist: remove wrong NULL terminator



This actually writes a NULL to some arbitrary location in the caller function's stack. Found by Coverity (Issue 1255746).

The start of the quote() function does char **str = tr; and is called like this,
quote(&sline);
sline in turn is just a char *sline;
The result of str[1] = NULL; is then, as far as I can tell, not anything good. I also can't see any other thing that might have been intended to be NULL-terminated here, so just remove it.

---
 Src/hist.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Src/hist.c b/Src/hist.c
index e65d78b..3dc0472 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2179,7 +2179,6 @@ quote(char **tr)
 	    *rptr++ = *ptr;
     *rptr++ = '\'';
     *rptr++ = 0;
-    str[1] = NULL;
     return 0;
 }
 
-- 
2.2.0.GIT



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