aboutsummaryrefslogtreecommitdiffstats
path: root/g10/gpg.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-07-14 06:49:23 +0000
committerNIIBE Yutaka <[email protected]>2023-07-14 06:49:23 +0000
commit5d375bb1682548a70882f270f8c8bba7033ab642 (patch)
tree61e5c426ad01a9fa49db58bf1acdf07581c18268 /g10/gpg.c
parentsm: Fix open_es_fread and open_es_fwrite for gnupg_fd_t. (diff)
downloadgnupg-5d375bb1682548a70882f270f8c8bba7033ab642.tar.gz
gnupg-5d375bb1682548a70882f270f8c8bba7033ab642.zip
gpg: Use is_secured_filename before opening the file.
* g10/gpg.c (print_mds): Check by is_secured_filename, earlier. * g10/tdbdump.c (import_ownertrust): Likewise. -- GnuPG-bug-id: 6508 Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/gpg.c')
-rw-r--r--g10/gpg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index d836ff072..23bf8d971 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -5622,13 +5622,13 @@ print_mds( const char *fname, int algo )
}
else
{
- fp = es_fopen (fname, "rb" );
- if (fp && is_secured_file (es_fileno (fp)))
+ if (is_secured_filename (fname))
{
- es_fclose (fp);
fp = NULL;
gpg_err_set_errno (EPERM);
}
+ else
+ fp = es_fopen (fname, "rb" );
}
if (!fp)
{