@@ -739,7 +739,7 @@ static int fuse_rs_create(const char* path, mode_t perms, struct fuse_file_info*
739
739
char * last_slash = strrchr (path , '/' );
740
740
741
741
int dirlen = last_slash - path ;
742
- char * directory_path = malloc (dirlen );
742
+ char * directory_path = calloc (dirlen + 1 , 1 );
743
743
strncpy (directory_path , path , dirlen );
744
744
745
745
fprintf (stderr , "%s\n" , directory_path );
@@ -768,7 +768,7 @@ static int fuse_rs_create(const char* path, mode_t perms, struct fuse_file_info*
768
768
unsigned long long int size = 0 ;
769
769
unsigned long long int block = free_space_pointer ;
770
770
free_space_pointer ++ ;
771
- unsigned char * name = calloc (38 , 1 );
771
+ unsigned char * name = calloc (38 ,1 );
772
772
strcpy (name , last_slash + 1 );
773
773
774
774
// if compressed
@@ -824,7 +824,7 @@ static int fuse_rs_mkdir(const char* path, mode_t perms) {
824
824
char * last_slash = strrchr (path , '/' );
825
825
826
826
int parlen = last_slash - path ;
827
- char * parent_path = malloc (parlen );
827
+ char * parent_path = calloc (parlen + 1 , 1 );
828
828
strncpy (parent_path , path , parlen );
829
829
830
830
unsigned long long int pdid = directory_position (parent_path );
0 commit comments