diff options
author | Thomas Rast <trast@student.ethz.ch> | 2008-12-06 21:50:09 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-07 02:41:45 -0800 |
commit | d551bbaf3af1fad947c704bdeb9cf664b34e38c6 (patch) | |
tree | ed32d59e4e83df723e6b9fdd973608cf7de87d78 | |
parent | 2ab4de57ea2c423fe8abae5278507106972ef1fe (diff) | |
download | git-d551bbaf3af1fad947c704bdeb9cf664b34e38c6.tar.gz git-d551bbaf3af1fad947c704bdeb9cf664b34e38c6.tar.xz |
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>
-rw-r--r-- | builtin-fetch-pack.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |