summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9c5a80)
raw | patch | inline | side by side (parent: f9c5a80)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Tue, 18 Dec 2007 06:12:03 +0000 (22:12 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Dec 2007 09:10:24 +0000 (01:10 -0800) |
In unpack-trees.c (line 593), we do
..
if (same(old, merge)) {
*merge = *old;
} else {
..
and that "merge" is a cache_entry pointer. If we have a non-zero
FLEX_ARRAY size, it will cause us to copy the first few bytes of the
name too.
That is technically wrong even for FLEX_ARRAY being 1, but you'll never
notice, since the filenames should always be the same with the current
code. But if we do the same thing for a rename, we'd be screwed.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
..
if (same(old, merge)) {
*merge = *old;
} else {
..
and that "merge" is a cache_entry pointer. If we have a non-zero
FLEX_ARRAY size, it will cause us to copy the first few bytes of the
name too.
That is technically wrong even for FLEX_ARRAY being 1, but you'll never
notice, since the filenames should always be the same with the current
code. But if we do the same thing for a rename, we'd be screwed.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c | patch | blob | history |
diff --git a/unpack-trees.c b/unpack-trees.c
index e9eb795d64b9cd6a6940995d41dd9c3f3239df02..aa2513ed798969c02fc5e14097666eb4c4c02bae 100644 (file)
--- a/unpack-trees.c
+++ b/unpack-trees.c
* a match.
*/
if (same(old, merge)) {
- *merge = *old;
+ memcpy(merge, old, offsetof(struct cache_entry, name));
} else {
verify_uptodate(old, o);
invalidate_ce_path(old);