From: Thomas Rast Date: Sat, 6 Dec 2008 20:50:09 +0000 (+0100) Subject: fetch-pack: Avoid memcpy() with src==dst X-Git-Tag: v1.6.0.5~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d551bbaf3af1fad947c704bdeb9cf664b34e38c6;p=git.git 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 --- 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;