From d551bbaf3af1fad947c704bdeb9cf664b34e38c6 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 6 Dec 2008 21:50:09 +0100 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- builtin-fetch-pack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 21ce3e016..22a57121a 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -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; -- 2.30.2