From 64982f75109dfc42967773f35301f2dcd30a1a9f Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Sun, 17 Apr 2005 20:31:40 -0700
Subject: [PATCH] [PATCH] (resend) show-diff.c off-by-one fix

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>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
 show-diff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/show-diff.c b/show-diff.c
index 8a66e59cf5..36afb3cc91 100644
--- a/show-diff.c
+++ b/show-diff.c
@@ -27,8 +27,8 @@ static char *sq_expand(char *src)
 	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;