diff options
Diffstat (limited to 'crypto/openssh/sshbuf-io.c')
| -rw-r--r-- | crypto/openssh/sshbuf-io.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/openssh/sshbuf-io.c b/crypto/openssh/sshbuf-io.c index 13ef40e7d272..426b7e2343c0 100644 --- a/crypto/openssh/sshbuf-io.c +++ b/crypto/openssh/sshbuf-io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshbuf-io.c,v 1.2 2020/01/25 23:28:06 djm Exp $ */ +/* $OpenBSD: sshbuf-io.c,v 1.4 2026/07/05 00:16:21 djm Exp $ */ /* * Copyright (c) 2011 Damien Miller * @@ -43,8 +43,7 @@ sshbuf_load_fd(int fd, struct sshbuf **blobp) if (fstat(fd, &st) == -1) return SSH_ERR_SYSTEM_ERROR; - if ((st.st_mode & (S_IFSOCK|S_IFCHR|S_IFIFO)) == 0 && - st.st_size > SSHBUF_SIZE_MAX) + if (S_ISREG(st.st_mode) && st.st_size > SSHBUF_SIZE_MAX) return SSH_ERR_INVALID_FORMAT; if ((blob = sshbuf_new()) == NULL) return SSH_ERR_ALLOC_FAIL; @@ -62,7 +61,7 @@ sshbuf_load_fd(int fd, struct sshbuf **blobp) goto out; } } - if ((st.st_mode & (S_IFSOCK|S_IFCHR|S_IFIFO)) == 0 && + if (S_ISREG(st.st_mode) != 0 && st.st_size != (off_t)sshbuf_len(blob)) { r = SSH_ERR_FILE_CHANGED; goto out; |
