{"thread":{"id":"17401","subject":"[PATCH 0/2] Fix two issues found by valgrind","startedAt":"2009-01-27T23:07:21Z","lastAt":"2009-01-27T23:17:20Z","messageCount":4,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"102191","messageId":"alpine.DEB.1.00.0901280005180.3586@pacific.mpi-cbg.de","threadId":"17401","inReplyTo":null,"subject":"[PATCH 0/2] Fix two issues found by valgrind","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T23:07:21Z","receivedAt":"2009-01-27T23:07:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Okay, not tons of issues.  But at least it was worth the hassle.\n\nJohannes Schindelin (2):\n  test-path-utils: Fix off by one, found by valgrind\n  get_sha1_basic(): fix invalid memory access, found by valgrind\n\n sha1_name.c       |    2 +-\n test-path-utils.c |    2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n"},{"id":"102192","messageId":"alpine.DEB.1.00.0901280007250.3586@pacific.mpi-cbg.de","threadId":"17401","inReplyTo":"alpine.DEB.1.00.0901280005180.3586@pacific.mpi-cbg.de","subject":"[PATCH 1/2] test-path-utils: Fix off by one, found by valgrind","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T23:07:36Z","receivedAt":"2009-01-27T23:07:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"When normalizing an absolute path, we might have to add a slash _and_ a\nNUL to the buffer, so the buffer was one too small.\n\nLet's just future proof the code and alloc PATH_MAX + 1 bytes.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n test-path-utils.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/test-path-utils.c b/test-path-utils.c\nindex a0bcb0e..2c0f5a3 100644\n--- a/test-path-utils.c\n+++ b/test-path-utils.c\n@@ -3,7 +3,7 @@\n int main(int argc, char **argv)\n {\n \tif (argc == 3 && !strcmp(argv[1], \"normalize_absolute_path\")) {\n-\t\tchar *buf = xmalloc(strlen(argv[2])+1);\n+\t\tchar *buf = xmalloc(PATH_MAX + 1);\n \t\tint rv = normalize_absolute_path(buf, argv[2]);\n \t\tassert(strlen(buf) == rv);\n \t\tputs(buf);\n-- \n1.6.1.482.g7d54be\n"},{"id":"102193","messageId":"alpine.DEB.1.00.0901280007400.3586@pacific.mpi-cbg.de","threadId":"17401","inReplyTo":"alpine.DEB.1.00.0901280005180.3586@pacific.mpi-cbg.de","subject":"[PATCH 2/2] get_sha1_basic(): fix invalid memory access, found by valgrind","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-27T23:07:46Z","receivedAt":"2009-01-27T23:07:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"When get_sha1_basic() is passed a buffer of len 0, it should not\ncheck if buf[len-1] is a curly bracket.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n sha1_name.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/sha1_name.c b/sha1_name.c\nindex 7d95bbb..5d0ac02 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -334,7 +334,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)\n \n \t/* basic@{time or number or -number} format to query ref-log */\n \treflog_len = at = 0;\n-\tif (str[len-1] == '}') {\n+\tif (len && str[len-1] == '}') {\n \t\tfor (at = len-2; at >= 0; at--) {\n \t\t\tif (str[at] == '@' && str[at+1] == '{') {\n \t\t\t\treflog_len = (len-1) - (at+2);\n-- \n1.6.1.482.g7d54be\n"},{"id":"102198","messageId":"7v63k01gqn.fsf@gitster.siamese.dyndns.org","threadId":"17401","inReplyTo":"alpine.DEB.1.00.0901280005180.3586@pacific.mpi-cbg.de","subject":"Re: [PATCH 0/2] Fix two issues found by valgrind","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-27T23:17:20Z","receivedAt":"2009-01-27T23:17:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> Okay, not tons of issues.  But at least it was worth the hassle.\n\nThanks.\n"}]}