Skip to content

Commit 9f5e909

Browse files
jnippulajenswi-linaro
authored andcommitted
tee-supplicant: fix uninit data access if stat() fails
do_mkdir() shall not rely on 'st' struct fields in case stat() call returns error. Signed-off-by: Jari Nippula <[email protected]> Reviewed-by: Jerome Forissier <[email protected]>
1 parent d6c3b39 commit 9f5e909

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tee-supplicant/src/tee_supp_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int do_mkdir(const char *path, mode_t mode)
105105
if (mkdir(path, mode) != 0 && errno != EEXIST)
106106
return -1;
107107

108-
if (stat(path, &st) != 0 && !S_ISDIR(st.st_mode))
108+
if (stat(path, &st) != 0 || !S_ISDIR(st.st_mode))
109109
return -1;
110110

111111
return 0;

0 commit comments

Comments
 (0)