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>
Thomas Rast committed
Dec 6, 2008 at 21:50 UTC
d551bbaf3af1fad947c704bdeb9cf664b34e38c6
1 file changed
+2
-1
builtin-fetch-pack.c
+2
-1
@@ -780,7 +780,8 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
780
struct ref *ref_cpy;
781
782
fetch_pack_setup();
783
- memcpy(&args, my_args, sizeof(args));
783
+ if (&args != my_args)
784
+ memcpy(&args, my_args, sizeof(args));
785
if (args.depth > 0) {
786
if (stat(git_path("shallow"), &st))
787
st.st_mtime = 0;