{"thread":{"id":"5670","subject":"Re: [PATCH 1/2] use SHA_DIGEST_LENGTH","startedAt":"2006-09-24T03:33:35Z","lastAt":"2006-09-24T03:33:35Z","messageCount":1,"participants":["David Rientjes"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"27529","messageId":"Pine.LNX.4.64N.0609232028290.14996@attu4.cs.washington.edu","threadId":"5670","inReplyTo":"Pine.LNX.4.64N.0609232011050.14284@attu4.cs.washington.edu","subject":"Re: [PATCH 1/2] use SHA_DIGEST_LENGTH","fromName":"David Rientjes","fromEmail":"rientjes@cs.washington.edu","sentAt":"2006-09-24T03:33:35Z","receivedAt":"2006-09-24T03:33:35Z","isPatch":true,"sender":{"key":"rientjes@cs.washington.edu","avatar":null},"body":"On Sat, 23 Sep 2006, David Rientjes wrote:\n\n> @@ -202,16 +202,17 @@ int cmd_name_rev(int argc, const char **\n>  #define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f'))\n>  \t\t\t\tif (!ishex(*p))\n>  \t\t\t\t\tforty = 0;\n> -\t\t\t\telse if (++forty == 40 &&\n> +\t\t\t\telse if (++forty == 2 * SHA_DIGEST_LENGTH &&\n>  \t\t\t\t\t\t!ishex(*(p+1))) {\n> -\t\t\t\t\tunsigned char sha1[40];\n> +\t\t\t\t\tunsigned char sha1[2 * SHA_DIGEST_LENGTH];\n>  \t\t\t\t\tconst char *name = \"undefined\";\n>  \t\t\t\t\tchar c = *(p+1);\n>  \n>  \t\t\t\t\tforty = 0;\n>  \n>  \t\t\t\t\t*(p+1) = 0;\n> -\t\t\t\t\tif (!get_sha1(p - 39, sha1)) {\n> +\t\t\t\t\tif (!get_sha1(p - (SHA_DIGEST_LENGTH + 1),\n> +\t\t\t\t\t\t      sha1)) {\n>  \t\t\t\t\t\tstruct object *o =\n>  \t\t\t\t\t\t\tlookup_object(sha1);\n>  \t\t\t\t\t\tif (o)\n\nOff by 18 error.\n\nSigned-off-by: David Rientjes <rientjes@cs.washington.edu>\n---\n builtin-name-rev.c |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin-name-rev.c b/builtin-name-rev.c\nindex f522664..ed99679 100644\n--- a/builtin-name-rev.c\n+++ b/builtin-name-rev.c\n@@ -211,7 +211,7 @@ #define ishex(x) (isdigit((x)) || ((x) >\n \t\t\t\t\tforty = 0;\n \n \t\t\t\t\t*(p+1) = 0;\n-\t\t\t\t\tif (!get_sha1(p - (SHA_DIGEST_LENGTH + 1),\n+\t\t\t\t\tif (!get_sha1(p - 2 * SHA_DIGEST_LENGTH + 1,\n \t\t\t\t\t\t      sha1)) {\n \t\t\t\t\t\tstruct object *o =\n \t\t\t\t\t\t\tlookup_object(sha1);\n"}]}