From: Marc-Christian Petersen <m.c.p@wolk-project.de>
To: linux-kernel@vger.kernel.org
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>
Subject: [PATCH 2.4] Fix d_path() truncating excessive long path name vulnerability
Date: Tue, 10 Dec 2002 03:28:21 +0100 [thread overview]
Message-ID: <200212100327.18991.m.c.p@wolk-project.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
Hi Marcelo,
there isn't fixed the d_path() long name truncation vulnerability
(see http://cert.uni-stuttgart.de/archive/bugtraq/2002/03/msg00384.html) in
2.4.x up to 2.4.21-BK.
This trivial patch fixes it. Instead of truncating the path with no error,
caller gets ENAMETOOLONG.
Patch credits go to Jirka Kosina.
Has been in WOLK and in -aa kernels for ages.
ciao, Marc
[-- Attachment #2: getcwd-err-1.patch --]
[-- Type: text/x-diff, Size: 1011 bytes --]
--- linux/fs/dcache.c.orig Mon Feb 25 20:38:08 2002
+++ linux/fs/dcache.c Mon Apr 1 04:16:45 2002
@@ -976,14 +976,17 @@
parent = dentry->d_parent;
namelen = dentry->d_name.len;
buflen -= namelen + 1;
- if (buflen < 0)
- break;
+ if (buflen < 0){
+ retval = ERR_PTR(-ENAMETOOLONG);
+ goto out;
+ }
end -= namelen;
memcpy(end, dentry->d_name.name, namelen);
*--end = '/';
retval = end;
dentry = parent;
}
+out:
return retval;
global_root:
namelen = dentry->d_name.len;
@@ -992,6 +995,8 @@
retval -= namelen-1; /* hit the slash */
memcpy(retval, dentry->d_name.name, namelen);
}
+ else
+ retval = ERR_PTR(-ENAMETOOLONG);
return retval;
}
@@ -1041,8 +1046,11 @@
spin_unlock(&dcache_lock);
error = -ERANGE;
+
+ if (cwd == ERR_PTR(-ENAMETOOLONG)) error = -ENAMETOOLONG;
+
len = PAGE_SIZE + page - cwd;
- if (len <= size) {
+ if (len <= size && error != -ENAMETOOLONG) {
error = len;
if (copy_to_user(buf, cwd, len))
error = -EFAULT;
reply other threads:[~2002-12-10 2:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200212100327.18991.m.c.p@wolk-project.de \
--to=m.c.p@wolk-project.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®