Git development
 help / color / mirror / Atom feed
* [PATCH] Fix off-by-one error in show-diff
@ 2005-04-17  5:56 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2005-04-17  5:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

The patch to introduce shell safety to show-diff has an
off-by-one error.  Here is an fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 show-diff.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

show-diff.c: 8a24ff62b85a6e23469e3f0e7a20170dfe543ebf
--- show-diff.c
+++ show-diff.c	2005-04-16 22:53:11.000000000 -0700
@@ -27,8 +27,8 @@
 	int cnt, c;
 	char *cp;
 
-	/* count single quote characters */ 
-	for (cnt = 0, cp = src; *cp; cnt++, cp++)
+	/* count bytes needed to store the quoted string. */ 
+	for (cnt = 1, cp = src; *cp; cnt++, cp++)
 		if (*cp == '\'')
 			cnt += 3;
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-17  5:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-17  5:56 [PATCH] Fix off-by-one error in show-diff Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox