git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	git@vger.kernel.org, "Erick Mattos" <erick.mattos@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH] check_aliased_update: strcpy() instead of strcat() to  copy
Date: Thu, 10 Jun 2010 15:26:16 -0400	[thread overview]
Message-ID: <AANLkTikNyyIk2952ei2kXsQJcznunmDJ30Ze2Sjb8V2M@mail.gmail.com> (raw)
In-Reply-To: <f99f845d5d0aa77b0a95c35f9289f1b031897d43.1276195180.git.trast@student.ethz.ch>

On Thu, Jun 10, 2010 at 2:43 PM, Thomas Rast <trast@student.ethz.ch> wrote:
> da3efdb (receive-pack: detect aliased updates which can occur with
> symrefs, 2010-04-19) introduced two strcat() into uninitialized
> strings.  The intent was clearly make a copy of the static buffer used
> by find_unique_abbrev(), so use strcpy() instead.
>
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>
>> Actually I think my test failure is related to da3efdb17b, see the
>> "[PATCH v2 2/2] receive-pack: detect aliased updates which can occur
>> with symrefs" thread.
>
> Indeed, there's another bug in this one.  (And valgrind catches it
> too...  if only I had the patience to let it churn through t5516!)
>
> Unlike the other bug, this one is already in master.
>
>  builtin/receive-pack.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index bb34757..7e4129d 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -515,9 +515,9 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
>        dst_cmd->skip_update = 1;
>
>        strcpy(cmd_oldh, find_unique_abbrev(cmd->old_sha1, DEFAULT_ABBREV));
> -       strcat(cmd_newh, find_unique_abbrev(cmd->new_sha1, DEFAULT_ABBREV));
> +       strcpy(cmd_newh, find_unique_abbrev(cmd->new_sha1, DEFAULT_ABBREV));
>        strcpy(dst_oldh, find_unique_abbrev(dst_cmd->old_sha1, DEFAULT_ABBREV));
> -       strcat(dst_newh, find_unique_abbrev(dst_cmd->new_sha1, DEFAULT_ABBREV));
> +       strcpy(dst_newh, find_unique_abbrev(dst_cmd->new_sha1, DEFAULT_ABBREV));
>        rp_error("refusing inconsistent update between symref '%s' (%s..%s) and"
>                 " its target '%s' (%s..%s)",
>                 cmd->ref_name, cmd_oldh, cmd_newh,

Thanks. I cannot imagine what I was thinking. Maybe a cut-and-paste
error from somewhere else. I am sad this made it all the way to
master.

j.

      parent reply	other threads:[~2010-06-10 19:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 12:43 [PATCH next] log_ref_setup: don't return stack-allocated array Thomas Rast
2010-06-10 12:54 ` [PATCH next v2] " Thomas Rast
2010-06-10 16:48   ` Erick Mattos
2010-06-10 17:29     ` Thomas Rast
2010-06-10 23:09       ` Erick Mattos
2010-06-11  5:12         ` Jeff King
2010-06-11 18:54           ` Erick Mattos
     [not found]   ` <AANLkTinI44rPfeXvWr-7jvAVyw5itX_gUsHimwSL74Lv@mail.gmail.com>
2010-06-10 18:09     ` Ævar Arnfjörð Bjarmason
2010-06-10 18:43       ` [PATCH] check_aliased_update: strcpy() instead of strcat() to copy Thomas Rast
2010-06-10 19:00         ` Ævar Arnfjörð Bjarmason
2010-06-10 19:26         ` Jay Soffian [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikNyyIk2952ei2kXsQJcznunmDJ30Ze2Sjb8V2M@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=avarab@gmail.com \
    --cc=erick.mattos@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).