File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2107,7 +2107,12 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
21072107 goto out_free ;
21082108 }
21092109
2110- fstat (in_fd , & st );
2110+ if (fstat (in_fd , & st ) == -1 ) {
2111+ error_errno (_ ("fstat on %s failed" ), config_filename );
2112+ ret = CONFIG_INVALID_FILE ;
2113+ goto out_free ;
2114+ }
2115+
21112116 contents_sz = xsize_t (st .st_size );
21122117 contents = xmmap_gently (NULL , contents_sz , PROT_READ ,
21132118 MAP_PRIVATE , in_fd , 0 );
@@ -2327,7 +2332,10 @@ int git_config_rename_section_in_file(const char *config_filename,
23272332 goto unlock_and_out ;
23282333 }
23292334
2330- fstat (fileno (config_file ), & st );
2335+ if (fstat (fileno (config_file ), & st ) == -1 ) {
2336+ ret = error_errno (_ ("fstat on %s failed" ), config_filename );
2337+ goto out ;
2338+ }
23312339
23322340 if (chmod (get_lock_file_path (lock ), st .st_mode & 07777 ) < 0 ) {
23332341 ret = error_errno ("chmod on %s failed" ,
You can’t perform that action at this time.
0 commit comments