All of lore.kernel.org
 help / color / mirror / Atom feed
From: <Andries.Brouwer@cwi.nl>
To: linux-kernel@vger.kernel.org
Subject: strlen_user and keys
Date: Sat, 8 Apr 2006 23:06:01 +0200 (MEST)	[thread overview]
Message-ID: <200604082106.k38L61j25619@apps.cwi.nl> (raw)

[faraway from home, not near recent kernel source]

strnlen_user() is documented as returning the string length including
terminating NUL. Probably that was a bad idea - people expect that
if user space and kernel library functions have similar names, they do
similar things. The shouting "INCLUDING" in the description already
shows that also the author expected that bugs would be created by
using this name.

[see, e.g., arch/i386/lib/usercopy.c]

security/keys/keyctl.c does

        dlen = strnlen_user(_description, PAGE_SIZE - 1);
	description = kmalloc(dlen + 1, GFP_KERNEL);
	copy_from_user(description, _description, dlen + 1);

copying one byte too many.
(Thus in some unknown kernel source tree, maybe 2.6.14.
This may have been fixed already.)

Andries

             reply	other threads:[~2006-04-08 21:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-08 21:06 Andries.Brouwer [this message]
2006-04-10 10:18 ` strlen_user and keys David Howells

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=200604082106.k38L61j25619@apps.cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --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.