summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 75118b1)
raw | patch | inline | side by side (parent: 75118b1)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 18 Apr 2005 03:31:40 +0000 (20:31 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Mon, 18 Apr 2005 03:31:40 +0000 (20:31 -0700) |
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>
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 | patch | blob | history |
diff --git a/show-diff.c b/show-diff.c
index 8a66e59cf5f6e05dd5944e479f95a2a12a6ccf95..36afb3cc91305c35d2d811be61b308c14fb1a63d 100644 (file)
--- a/show-diff.c
+++ b/show-diff.c
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;