Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] Fix off-by-one error in show-diff
Date: Sat, 16 Apr 2005 22:56:29 -0700	[thread overview]
Message-ID: <7vsm1q0wvm.fsf@assigned-by-dhcp.cox.net> (raw)

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;
 


                 reply	other threads:[~2005-04-17  5:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vsm1q0wvm.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox