{"thread":{"id":"72","subject":"[PATCH] Fix off-by-one error in show-diff","startedAt":"2005-04-17T05:56:29Z","lastAt":"2005-04-17T05:56:29Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"446","messageId":"7vsm1q0wvm.fsf@assigned-by-dhcp.cox.net","threadId":"72","inReplyTo":null,"subject":"[PATCH] Fix off-by-one error in show-diff","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-17T05:56:29Z","receivedAt":"2005-04-17T05:56:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The patch to introduce shell safety to show-diff has an\noff-by-one error.  Here is an fix.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n show-diff.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\nshow-diff.c: 8a24ff62b85a6e23469e3f0e7a20170dfe543ebf\n--- show-diff.c\n+++ show-diff.c\t2005-04-16 22:53:11.000000000 -0700\n@@ -27,8 +27,8 @@\n \tint cnt, c;\n \tchar *cp;\n \n-\t/* count single quote characters */ \n-\tfor (cnt = 0, cp = src; *cp; cnt++, cp++)\n+\t/* count bytes needed to store the quoted string. */ \n+\tfor (cnt = 1, cp = src; *cp; cnt++, cp++)\n \t\tif (*cp == '\\'')\n \t\t\tcnt += 3;\n \n\n"}]}