{"thread":{"id":"24110","subject":"[PATCH] Fix strcat() on uninitialized memory","startedAt":"2010-06-14T16:19:24Z","lastAt":"2010-06-14T17:50:24Z","messageCount":4,"participants":["Johannes Schindelin","Jay Soffian"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"143683","messageId":"alpine.DEB.1.00.1006141032250.2689@bonsai2","threadId":"24110","inReplyTo":null,"subject":"[PATCH] Fix strcat() on uninitialized memory","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-06-14T16:19:24Z","receivedAt":"2010-06-14T16:19:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nUnder certain circumstances, this bug would trigger a buffer overflow\nerror with libc, and fail test 5516.\n\nStrbufs would have avoided the issue.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n builtin/receive-pack.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 05071c3..1644424 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -569,9 +569,9 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)\n \tdst_cmd->skip_update = 1;\n \n \tstrcpy(cmd_oldh, find_unique_abbrev(cmd->old_sha1, DEFAULT_ABBREV));\n-\tstrcat(cmd_newh, find_unique_abbrev(cmd->new_sha1, DEFAULT_ABBREV));\n+\tstrcpy(cmd_newh, find_unique_abbrev(cmd->new_sha1, DEFAULT_ABBREV));\n \tstrcpy(dst_oldh, find_unique_abbrev(dst_cmd->old_sha1, DEFAULT_ABBREV));\n-\tstrcat(dst_newh, find_unique_abbrev(dst_cmd->new_sha1, DEFAULT_ABBREV));\n+\tstrcpy(dst_newh, find_unique_abbrev(dst_cmd->new_sha1, DEFAULT_ABBREV));\n \trp_error(\"refusing inconsistent update between symref '%s' (%s..%s) and\"\n \t\t \" its target '%s' (%s..%s)\",\n \t\t cmd->ref_name, cmd_oldh, cmd_newh,\n-- \n1.7.1.msysgit.0.2.g2fefc8\n"},{"id":"143684","messageId":"AANLkTimSFwn1yykyEOTRdHHBYTFUEhxqj2AinjRv9ECC@mail.gmail.com","threadId":"24110","inReplyTo":"alpine.DEB.1.00.1006141032250.2689@bonsai2","subject":"Re: [PATCH] Fix strcat() on uninitialized memory","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-14T16:34:58Z","receivedAt":"2010-06-14T16:34:58Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Thanks, this was caught last week and patch posted by Thomas:\n\nhttp://marc.info/?l=git&m=127619546001346&w=2\n\nj.\n\nOn Mon, Jun 14, 2010 at 12:19 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n>\n> Under certain circumstances, this bug would trigger a buffer overflow\n> error with libc, and fail test 5516.\n>\n> Strbufs would have avoided the issue.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>  builtin/receive-pack.c |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\n> index 05071c3..1644424 100644\n> --- a/builtin/receive-pack.c\n> +++ b/builtin/receive-pack.c\n> @@ -569,9 +569,9 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)\n>        dst_cmd->skip_update = 1;\n>\n>        strcpy(cmd_oldh, find_unique_abbrev(cmd->old_sha1, DEFAULT_ABBREV));\n> -       strcat(cmd_newh, find_unique_abbrev(cmd->new_sha1, DEFAULT_ABBREV));\n> +       strcpy(cmd_newh, find_unique_abbrev(cmd->new_sha1, DEFAULT_ABBREV));\n>        strcpy(dst_oldh, find_unique_abbrev(dst_cmd->old_sha1, DEFAULT_ABBREV));\n> -       strcat(dst_newh, find_unique_abbrev(dst_cmd->new_sha1, DEFAULT_ABBREV));\n> +       strcpy(dst_newh, find_unique_abbrev(dst_cmd->new_sha1, DEFAULT_ABBREV));\n>        rp_error(\"refusing inconsistent update between symref '%s' (%s..%s) and\"\n>                 \" its target '%s' (%s..%s)\",\n>                 cmd->ref_name, cmd_oldh, cmd_newh,\n> --\n> 1.7.1.msysgit.0.2.g2fefc8\n>\n>\n"},{"id":"143689","messageId":"alpine.DEB.1.00.1006141856030.2689@bonsai2","threadId":"24110","inReplyTo":"AANLkTimSFwn1yykyEOTRdHHBYTFUEhxqj2AinjRv9ECC@mail.gmail.com","subject":"Re: [PATCH] Fix strcat() on uninitialized memory","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-06-14T17:05:26Z","receivedAt":"2010-06-14T17:05:26Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 14 Jun 2010, Jay Soffian wrote:\n\n> Thanks, this was caught last week and patch posted by Thomas:\n> \n> http://marc.info/?l=git&m=127619546001346&w=2\n\nGreat. So it was caught. Why was it not even in 'next', so I wasted my \ntime finding the bug?\n\nAnyway, it is in 4msysgit.git's 'devel' branch. So its fixed now.\n\nFrustrated,\nDscho\n"},{"id":"143693","messageId":"AANLkTiknleOJ8uZyUE1V1ar7eET_Ksb1hTJiPWkdx5po@mail.gmail.com","threadId":"24110","inReplyTo":"alpine.DEB.1.00.1006141856030.2689@bonsai2","subject":"Re: [PATCH] Fix strcat() on uninitialized memory","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-06-14T17:50:24Z","receivedAt":"2010-06-14T17:50:24Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Mon, Jun 14, 2010 at 1:05 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Great. So it was caught. Why was it not even in 'next', so I wasted my\n> time finding the bug?\n\nJunio recently switched jobs and is perhaps a bit behind.\n\n> Anyway, it is in 4msysgit.git's 'devel' branch. So its fixed now.\n>\n> Frustrated,\n\nSorry for the original bug. I'm still not sure how I made such a\nboneheaded mistake. It looks like I might have stupidly copy/pasted\nthe matching lines from builtin/fetch.c of \"git grep\nfind_unique_abbrev\" output.\n\nj.\n"}]}