Skip to content

Commit 6d85834

Browse files
adlternativegitster
authored andcommitted
read-cache.c: reduce unnecessary cache entry name copying
575fa8a (read-cache: read data in a hash-independent way, 2019-02-19) added a new code to copy from the on-disk data into the name member of the in-core cache entry, which is already done immediately after that in a way that takes prefix-compression into account. Remove this code, as it is not just unnecessary, but also can be reading beyond the on-disk data, when we are copying very long prefix string from the previous entry. Signed-off-by: ZheNing Hu <[email protected]> [jc: rewrote the log message with Réne's findings] Signed-off-by: Junio C Hamano <[email protected]>
1 parent e54793a commit 6d85834

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

read-cache.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,8 +1944,6 @@ static struct cache_entry *create_from_disk(struct mem_pool *ce_mem_pool,
19441944
ce->ce_namelen = len;
19451945
ce->index = 0;
19461946
oidread(&ce->oid, ondisk->data);
1947-
memcpy(ce->name, name, len);
1948-
ce->name[len] = '\0';
19491947

19501948
if (expand_name_field) {
19511949
if (copy_len)

0 commit comments

Comments
 (0)