mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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 <gniibe@fsij.org>
This commit is contained in:
parent
cf270b0d30
commit
5d375bb168
@ -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)
|
||||
{
|
||||
|
@ -141,15 +141,12 @@ import_ownertrust (ctrl_t ctrl, const char *fname )
|
||||
fname = "[stdin]";
|
||||
is_stdin = 1;
|
||||
}
|
||||
else if( !(fp = es_fopen( fname, "r" )) ) {
|
||||
else if (is_secured_filename (fname)) {
|
||||
gpg_err_set_errno (EPERM);
|
||||
log_error (_("can't open '%s': %s\n"), fname, strerror(errno) );
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_secured_file (es_fileno (fp)))
|
||||
{
|
||||
es_fclose (fp);
|
||||
gpg_err_set_errno (EPERM);
|
||||
else if( !(fp = es_fopen( fname, "r" )) ) {
|
||||
log_error ( _("can't open '%s': %s\n"), fname, strerror(errno) );
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user