Browse Source

fetch-pack: Avoid memcpy() with src==dst

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>
maint
Thomas Rast 16 years ago committed by Junio C Hamano
parent
commit
d551bbaf3a
  1. 3
      builtin-fetch-pack.c

3
builtin-fetch-pack.c

@ -780,7 +780,8 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, @@ -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;

Loading…
Cancel
Save