All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@oracle.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] isdnloop: NUL-terminate strings from userspace
Date: Fri, 07 Mar 2014 12:42:12 +0100	[thread overview]
Message-ID: <5319B094.7060709@oracle.com> (raw)
In-Reply-To: <20140307112655.GJ4774@mwanda>

On 03/07/2014 12:26 PM, Dan Carpenter wrote:
> On Fri, Mar 07, 2014 at 11:56:04AM +0100, Vegard Nossum wrote:
>> Both the in-kernel and BSD strlcpy() require that the source string is
>> NUL terminated.
>
> No.  You're obviously wrong.  What on earth?

Well, from lib/string.c:

size_t strlcpy(char *dest, const char *src, size_t size)
{
         size_t ret = strlen(src);

The BSD man page:

"Also note that strlcpy() and strlcat() only operate on true ``C'' 
strings.  This means that for strlcpy() src must be NUL-terminated and 
for strlcat() both src and dst must be NUL-terminated."


Vegard

  reply	other threads:[~2014-03-07 11:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 10:56 [PATCH] isdnloop: NUL-terminate strings from userspace Vegard Nossum
2014-03-07 11:26 ` Dan Carpenter
2014-03-07 11:42   ` Vegard Nossum [this message]
2014-03-07 11:52     ` Dan Carpenter
2014-03-07 12:44       ` Vegard Nossum
2014-03-07 13:05         ` Dan Carpenter
2014-03-31 12:56 ` Vegard Nossum
2014-03-31 13:36   ` Dan Carpenter
2014-03-31 13:44     ` Vegard Nossum
2014-03-31 16:48   ` David Miller
2014-04-01 10:08 Vegard Nossum
2014-04-01 10:30 ` Hannes Frederic Sowa
2014-04-01 10:46   ` Vegard Nossum
2014-04-01 11:02     ` Hannes Frederic Sowa
2014-04-01 12:35       ` Dan Carpenter
2014-04-01 20:18         ` David Miller
2014-04-01 11:23 ` YOSHIFUJI Hideaki

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=5319B094.7060709@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --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.