mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-11-06 05:16:43 +00:00
upstream: prefer fstat to stat when it's trivial to do so
OpenBSD-Commit-ID: 3af5548ba2112045db392a14c959ca309605bdb9
This commit is contained in:
1 parent
cadefc724f
commit
1bf5871aea
1 file changed
+2
-2
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: authfile.c,v 1.151 2026/06/29 09:14:25 djm Exp $ */
|
||||
/* $OpenBSD: authfile.c,v 1.152 2026/07/07 04:04:16 djm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
|
||||
*
|
||||
@@ -207,7 +207,7 @@ sshkey_try_load_public(struct sshkey **kp, const char *filename,
|
||||
*commentp = NULL;
|
||||
if ((f = fopen(filename, "r")) == NULL)
|
||||
return SSH_ERR_SYSTEM_ERROR;
|
||||
if (stat(filename, &st) == 0 && S_ISREG(st.st_mode) &&
|
||||
if (fstat(fileno(f), &st) == 0 && S_ISREG(st.st_mode) &&
|
||||
st.st_size > SSHBUF_SIZE_MAX) {
|
||||
fclose(f);
|
||||
return SSH_ERR_INVALID_FORMAT;
|
||||
|
||||
Reference in new issue
Block a user