Skip to content

Commit

Permalink
fetch-pack: Avoid memcpy() with src==dst
Browse files Browse the repository at this point in the history
memcpy() may only be used for disjoint memory areas, but when invoked
from cmd_fetch_pack(), we have my_args == &args.  (The argument cannot
be removed entirely because transport.c invokes with its own
variable.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Dec 7, 2008
1 parent 2ab4de5 commit d551bba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin-fetch-pack.c
Original file line number Diff line number Diff line change
@@ -780,7 +780,8 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
struct ref *ref_cpy;

fetch_pack_setup();
memcpy(&args, my_args, sizeof(args));
if (&args != my_args)
memcpy(&args, my_args, sizeof(args));
if (args.depth > 0) {
if (stat(git_path("shallow"), &st))
st.st_mtime = 0;

0 comments on commit d551bba

Please sign in to comment.