Skip to content

Commit

Permalink
read_index(): fix reading extension size on BE 64-bit archs
Browse files Browse the repository at this point in the history
On big endian platforms with 8-byte unsigned long, the code reads the
size of the index extension section (which is a 4-byte network byte
order integer) incorrectly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nathaniel W Filardo authored and Junio C Hamano committed Dec 27, 2009
1 parent 7a51ed6 commit 07cc8ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion read-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ int read_index_from(struct index_state *istate, const char *path)
* extension name (4-byte) and section length
* in 4-byte network byte order.
*/
unsigned long extsize;
uint32_t extsize;
memcpy(&extsize, (char *)mmap + src_offset + 4, 4);
extsize = ntohl(extsize);
if (read_index_extension(istate,
Expand Down

0 comments on commit 07cc8ec

Please sign in to comment.