File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed 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,
2107
2107
goto out_free ;
2108
2108
}
2109
2109
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
+
2111
2116
contents_sz = xsize_t (st .st_size );
2112
2117
contents = xmmap_gently (NULL , contents_sz , PROT_READ ,
2113
2118
MAP_PRIVATE , in_fd , 0 );
@@ -2327,7 +2332,10 @@ int git_config_rename_section_in_file(const char *config_filename,
2327
2332
goto unlock_and_out ;
2328
2333
}
2329
2334
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
+ }
2331
2339
2332
2340
if (chmod (get_lock_file_path (lock ), st .st_mode & 07777 ) < 0 ) {
2333
2341
ret = error_errno ("chmod on %s failed" ,
You can’t perform that action at this time.
0 commit comments