[openssh-commits] [openssh] branch master updated: upstream: avoid possible over-read when a SFTP READPATH operations
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Oct 29 15:43:48 AEDT 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
The following commit(s) were added to refs/heads/master by this push:
new e4d03fbf9 upstream: avoid possible over-read when a SFTP READPATH operations
e4d03fbf9 is described below
commit e4d03fbf9227cce08844c2fa9b51ffffb3985849
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Oct 29 04:41:59 2026 +0000
upstream: avoid possible over-read when a SFTP READPATH operations
return a zero- length path. Patch from immortal-jelly
<xuehaolin at uniontech.com>
OpenBSD-Commit-ID: 4f30d7d378626d333d2718fefcb3e62d42777c34
---
sftp-realpath.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sftp-realpath.c b/sftp-realpath.c
index 2ec779d8f..937d45dfd 100644
--- a/sftp-realpath.c
+++ b/sftp-realpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-realpath.c,v 1.2 2021/09/02 21:03:54 deraadt Exp $ */
+/* $OpenBSD: sftp-realpath.c,v 1.3 2026/10/29 04:41:59 djm Exp $ */
/*
* Copyright (c) 2003 Constantin S. Svintsoff <kostik at iclub.nsu.ru>
*
@@ -173,6 +173,11 @@ sftp_realpath(const char *path, char *resolved)
slen = readlink(resolved, symlink, sizeof(symlink) - 1);
if (slen < 0)
goto err;
+ if (slen == 0) {
+ /* refuse empty links */
+ errno = ENOENT;
+ goto err;
+ }
symlink[slen] = '\0';
if (symlink[0] == '/') {
resolved[1] = 0;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list