From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Davi Arnaut <davi.arnaut@gmail.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATH 0/2] strndup_user, description
Date: Wed, 15 Feb 2006 02:53:10 +0000 [thread overview]
Message-ID: <1139971990.14831.2.camel@localhost.localdomain> (raw)
In-Reply-To: <20060214214747.ef05e4d8.davi.arnaut@gmail.com>
On Maw, 2006-02-14 at 21:47 -0300, Davi Arnaut wrote:
> This patch series creates a strndup_user() function in order to avoid duplicated
> and error-prone (userspace modifying the string after the strlen_user()) code.
Well userspace can still modify in this case. So you could still get a
\0 mid buffer but that seems harmless.
However
> +#define strdup_user(s) strndup_user(s, PAGE_SIZE)
Better this doesn't exist as it is a wrapper for a bad habit that isnt
yet used so why encourage it.
> + length = strlen_user(s);
What if n is very large ? Should use strnlen_user clipped by n
Also say the length limit is 8 and the text is "hello\0"
We get length = 5 5 < 8, alloc 5 bytes set 5th to \0 and return "hell
\0"
next prev parent reply other threads:[~2006-02-15 2:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-15 0:47 [PATH 0/2] strndup_user, description Davi Arnaut
2006-02-15 2:53 ` Alan Cox [this message]
2006-02-15 10:42 ` Davi Arnaut
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=1139971990.14831.2.camel@localhost.localdomain \
--to=alan@lxorguk.ukuu.org.uk \
--cc=akpm@osdl.org \
--cc=davi.arnaut@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox