Git development
 help / color / mirror / Atom feed
From: "Peter Eriksen" <s022018@student.dtu.dk>
To: git@vger.kernel.org
Subject: Re: Unanticipated test error
Date: Fri, 21 Jul 2006 10:19:54 +0200	[thread overview]
Message-ID: <20060721081954.GA29645@bohr.gbar.dtu.dk> (raw)
In-Reply-To: <81b0412b0607210022o562ac326wd149c73cc529f239@mail.gmail.com>

On Fri, Jul 21, 2006 at 09:22:44AM +0200, Alex Riesen wrote:
...
> Well, there are differences. Correct translation from memcpy
> to strlcpy (aside the fact with \0 inside the string) would be
> something like:
> 
>  strlcpy(to, from, len + 1);
> 
> assuming your example with memcpy. strlcpy expects size of
> storage, and will never write more bytes that it was allowed to.
> That'll cut off last character of the source string, unless it is
> \0-terminated before the size of storage.

I see it now.  What I did was wrong.  Appending " + 1" to every
one of my calls makes the patch survive "make test".  However,
since strlcpy() calls strlen(from), it would have to be checked,
that 'from' is always NUL terminated.  The benefits of this patch
seem to shrink.

Thank you for your comment!

Peter

  reply	other threads:[~2006-07-21  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-20 19:40 Unanticipated test error Peter Eriksen
2006-07-21  7:22 ` Alex Riesen
2006-07-21  8:19   ` Peter Eriksen [this message]
2006-07-21 14:54     ` Alex Riesen

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=20060721081954.GA29645@bohr.gbar.dtu.dk \
    --to=s022018@student.dtu.dk \
    --cc=git@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