resource: disk: Remove unnecessary pre-checking for opening file 36/280236/2
authorDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 25 Aug 2022 08:15:24 +0000 (17:15 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 30 Aug 2022 00:29:40 +0000 (09:29 +0900)
commit0ea2f26454b9a6725135d00d0898a56626c05939
tree1ce9d73388db5c1ebdf25899c9ec9842e865b229
parent15aef3e2ba53fe70dd308ebeab38329b1272aa62
resource: disk: Remove unnecessary pre-checking for opening file

Instead of checking file existence before opening, now just try to
open file. If the file does not exist, it makes errors though.
This also fixes the vulnerability reports about TOCTOU race condition
(CWE-367).

Change-Id: I10affc264666566b635e1cd8b91ad34fe5613845
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/resource/resource-disk.c