@@ -564,8 +564,8 @@ int get_extents(char *filename, int fd, struct stat *stats) {
564564 uint64_t ext_ctr = 0 ;
565565 struct file_counter_map * temp = NULL ;
566566
567- fiemap = calloc (1 , sizeof (struct fiemap )
568- + sizeof (struct fiemap_extent ) * stats -> st_blocks );
567+ fiemap = calloc (1 , sizeof (struct fiemap ) +
568+ sizeof (struct fiemap_extent ) * stats -> st_blocks );
569569 extent = calloc (1 , sizeof (struct extent ));
570570
571571 fiemap -> fm_flags = FIEMAP_FLAG_SYNC ;
@@ -742,7 +742,8 @@ int contains_element(uint32_t list[], uint32_t element, uint32_t size) {
742742 * */
743743uint32_t get_file_extent_count (char * file ) {
744744 for (uint32_t i = 0 ; i < ctrl .file_counter_map -> file_ctr ; i ++ ) {
745- if (strncmp (ctrl .file_counter_map -> files [i ].file , file ,
745+ if (strlen (ctrl .file_counter_map -> files [i ].file ) == strlen (file ) &&
746+ strncmp (ctrl .file_counter_map -> files [i ].file , file ,
746747 strlen (ctrl .file_counter_map -> files [i ].file )) == 0 ) {
747748 return ctrl .file_counter_map -> files [i ].ext_ctr ;
748749 }
@@ -767,7 +768,8 @@ void increase_file_segment_counter(char *file, unsigned int num_segments,
767768 enum type type = seg_i -> type ;
768769
769770 for (i = 0 ; i < ctrl .file_counter_map -> file_ctr ; i ++ ) {
770- if (strncmp (ctrl .file_counter_map -> files [i ].file , file ,
771+ if (strlen (ctrl .file_counter_map -> files [i ].file ) == strlen (file ) &&
772+ strncmp (ctrl .file_counter_map -> files [i ].file , file ,
771773 strlen (ctrl .file_counter_map -> files [i ].file )) == 0 ) {
772774 goto found ;
773775 }
0 commit comments