All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clement LECIGNE <clemun@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [BUG][SECURITY] Kernel stack overflow in hfs_mac2asc()
Date: Wed, 9 Nov 2011 20:08:48 +0100	[thread overview]
Message-ID: <20111109190802.GA4540@ounaide> (raw)

Hi lkml,

I have found there is no len nor bound checkings in hfs_mac2asc()
function against the size of the out buffer passed as parameter.
The src size can be greater than HFS_MAX_NAMELEN on malformed file
system. HFS_MAX_NAMELEN is 31 whereas src size can be set up to
255 (unsigned char).

This can lead to a basic kernel stack overflow with user controlled
data through for example hfs_readdir() which calls hfs_mac2asc() with
out buffer "allocated" on the stack.

This overflow can be simply fixed by adding bound checks on srclen
before doing the copy.

Best regards,

-- 
Clément LECIGNE,
"In Python, how do you create a string of random characters? Read a Perl
file!"

                 reply	other threads:[~2011-11-09 19:08 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=20111109190802.GA4540@ounaide \
    --to=clemun@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.