zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: hist: remove wrong NULL terminator
@ 2015-01-09 12:43 Mikael Magnusson
  2015-01-09 17:45 ` Ray Andrews
  2015-01-10  7:08 ` PATCH: hist: remove wrong NULL terminator Bart Schaefer
  0 siblings, 2 replies; 36+ messages in thread
From: Mikael Magnusson @ 2015-01-09 12:43 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2015-01-12 16:55 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 12:43 PATCH: hist: remove wrong NULL terminator Mikael Magnusson
2015-01-09 17:45 ` Ray Andrews
2015-01-09 18:33   ` Lawrence Velázquez
2015-01-09 18:36     ` Lawrence Velázquez
2015-01-09 19:38   ` Mikael Magnusson
2015-01-09 21:39     ` Ray Andrews
2015-01-09 22:30       ` Peter Stephenson
2015-01-09 23:39         ` Ray Andrews
2015-01-10  0:39           ` Bart Schaefer
2015-01-10  7:45             ` Ray Andrews
2015-01-10 22:04               ` Lawrence Velázquez
2015-01-10 22:50                 ` Ray Andrews
2015-01-11  1:58                   ` Bart Schaefer
2015-01-11  5:46                     ` Ray Andrews
2015-01-11  7:10                       ` Floating point modulus Bart Schaefer
2015-01-11 17:33                         ` Peter Stephenson
2015-01-11 19:25                           ` Bart Schaefer
2015-01-11 19:25                         ` Ray Andrews
2015-01-11 20:00                           ` Bart Schaefer
2015-01-11 20:58                             ` Ray Andrews
2015-01-11 21:34                               ` Peter Stephenson
2015-01-12  0:18                                 ` Ray Andrews
2015-01-12 10:03                                   ` Peter Stephenson
2015-01-11 19:36                         ` Bart Schaefer
2015-01-11 20:01                           ` Peter Stephenson
2015-01-11 20:04                             ` Bart Schaefer
2015-01-11 20:25                               ` Peter Stephenson
2015-01-12  0:02                                 ` Ray Andrews
2015-01-12  2:23                                   ` Bart Schaefer
2015-01-12  2:46                                 ` Bart Schaefer
2015-01-12  9:56                                   ` Peter Stephenson
2015-01-12 13:49                                     ` Peter Stephenson
2015-01-12 16:35                                     ` Bart Schaefer
2015-01-12 16:45                                       ` Peter Stephenson
2015-01-12 11:36                           ` Vincent Lefevre
2015-01-10  7:08 ` PATCH: hist: remove wrong NULL terminator Bart Schaefer

Code repositories for project(s) associated with this public 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).