sha1_file: guard against invalid loose subdirectory numbers
Loose object subdirectories have hexadecimal names based on the first byte of the hash of contained objects, thus their numerical representation can range from 0 (0x00) to 255 (0xff). Change the type of the corresponding variable in for_each_file_in_obj_subdir() and associated callback functions to unsigned int and add a range check. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0375f472d4
commit
70c49050d4
@ -537,7 +537,7 @@ static int fsck_cruft(const char *basename, const char *path, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fsck_subdir(int nr, const char *path, void *progress)
|
||||
static int fsck_subdir(unsigned int nr, const char *path, void *progress)
|
||||
{
|
||||
display_progress(progress, nr + 1);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user