MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / check_cramfs

Function check_cramfs

src/cramfs.c:43–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb, const partition_t *partition, const int verbose);
42
43int check_cramfs(disk_t *disk_car,partition_t *partition,const int verbose)
44{
45 unsigned char *buffer=(unsigned char*)MALLOC(CRAMFS_SUPERBLOCK_SIZE);
46 if(disk_car->pread(disk_car, buffer, CRAMFS_SUPERBLOCK_SIZE, partition->part_offset + 0x200) == CRAMFS_SUPERBLOCK_SIZE)
47 {
48 if(test_cramfs(disk_car, (struct cramfs_super*)buffer, partition, verbose)==0)
49 {
50 set_cramfs_info((struct cramfs_super*)buffer, partition);
51 free(buffer);
52 return 0;
53 }
54 }
55 if(disk_car->pread(disk_car, buffer, CRAMFS_SUPERBLOCK_SIZE, partition->part_offset) == CRAMFS_SUPERBLOCK_SIZE)
56 {
57 if(test_cramfs(disk_car, (struct cramfs_super*)buffer, partition, verbose)==0)
58 {
59 set_cramfs_info((struct cramfs_super*)buffer, partition);
60 free(buffer);
61 return 0;
62 }
63 }
64 free(buffer);
65 return 1;
66}
67
68static int test_cramfs(const disk_t *disk_car, const struct cramfs_super *sb, const partition_t *partition, const int verbose)
69{

Callers 2

check_part_noneFunction · 0.85
check_linuxFunction · 0.85

Calls 3

MALLOCFunction · 0.85
test_cramfsFunction · 0.85
set_cramfs_infoFunction · 0.85

Tested by

no test coverage detected