mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
18097ee961
Coverity has rightfully complained that using stat() before opening file
leads to TOCTOU issues, refactor the code to open the file first and
then perform stat checks on the opened file descriptor. It is still far
from foolproof, as the file is not locked, and stat() is used elsewhere,
but at least it seems to be a step in the right direction.
Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1690686
Fixes: 80b7e49c27 "Use mmap for pkeyutl -rawin and dgst one-shot input"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Wed Apr 1 12:46:08 2026
(Merged from https://github.com/openssl/openssl/pull/30624)