git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix off-by-one error in show-diff

From
Junio C Hamano <junkio@cox.net>
Date
Apr 17, 2005, 05:56 UTC
Message-ID
<7vsm1q0wvm.fsf@assigned-by-dhcp.cox.net>

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;
 
Message 1 of 1 in “Fix off-by-one error in show-diff”
  1. Fix off-by-one error in show-diffJunio C Hamano, Apr 17, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.