All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix strcat() on uninitialized memory
@ 2010-06-14 16:19 Johannes Schindelin
  2010-06-14 16:34 ` Jay Soffian
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2010-06-14 16:19 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git


Under certain circumstances, this bug would trigger a buffer overflow
error with libc, and fail test 5516.

Strbufs would have avoided the issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 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 05071c3..1644424 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -569,9 +569,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,
-- 
1.7.1.msysgit.0.2.g2fefc8

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix strcat() on uninitialized memory
  2010-06-14 16:19 [PATCH] Fix strcat() on uninitialized memory Johannes Schindelin
@ 2010-06-14 16:34 ` Jay Soffian
  2010-06-14 17:05   ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Soffian @ 2010-06-14 16:34 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Thanks, this was caught last week and patch posted by Thomas:

http://marc.info/?l=git&m=127619546001346&w=2

j.

On Mon, Jun 14, 2010 at 12:19 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> Under certain circumstances, this bug would trigger a buffer overflow
> error with libc, and fail test 5516.
>
> Strbufs would have avoided the issue.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  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 05071c3..1644424 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -569,9 +569,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,
> --
> 1.7.1.msysgit.0.2.g2fefc8
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix strcat() on uninitialized memory
  2010-06-14 16:34 ` Jay Soffian
@ 2010-06-14 17:05   ` Johannes Schindelin
  2010-06-14 17:50     ` Jay Soffian
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2010-06-14 17:05 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git

Hi,

On Mon, 14 Jun 2010, Jay Soffian wrote:

> Thanks, this was caught last week and patch posted by Thomas:
> 
> http://marc.info/?l=git&m=127619546001346&w=2

Great. So it was caught. Why was it not even in 'next', so I wasted my 
time finding the bug?

Anyway, it is in 4msysgit.git's 'devel' branch. So its fixed now.

Frustrated,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix strcat() on uninitialized memory
  2010-06-14 17:05   ` Johannes Schindelin
@ 2010-06-14 17:50     ` Jay Soffian
  0 siblings, 0 replies; 4+ messages in thread
From: Jay Soffian @ 2010-06-14 17:50 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On Mon, Jun 14, 2010 at 1:05 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Great. So it was caught. Why was it not even in 'next', so I wasted my
> time finding the bug?

Junio recently switched jobs and is perhaps a bit behind.

> Anyway, it is in 4msysgit.git's 'devel' branch. So its fixed now.
>
> Frustrated,

Sorry for the original bug. I'm still not sure how I made such a
boneheaded mistake. It looks like I might have stupidly copy/pasted
the matching lines from builtin/fetch.c of "git grep
find_unique_abbrev" output.

j.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-14 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-14 16:19 [PATCH] Fix strcat() on uninitialized memory Johannes Schindelin
2010-06-14 16:34 ` Jay Soffian
2010-06-14 17:05   ` Johannes Schindelin
2010-06-14 17:50     ` Jay Soffian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.