From: "Alex Riesen" <raa.lkml@gmail.com>
To: "Peter Eriksen" <s022018@student.dtu.dk>
Cc: git@vger.kernel.org
Subject: Re: Unanticipated test error
Date: Fri, 21 Jul 2006 16:54:57 +0200 [thread overview]
Message-ID: <81b0412b0607210754m1e3c8bf9ne717786e666fa7e1@mail.gmail.com> (raw)
In-Reply-To: <20060721081954.GA29645@bohr.gbar.dtu.dk>
On 7/21/06, Peter Eriksen <s022018@student.dtu.dk> 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.
Probably, but you still have room to balance benefits.
prev parent reply other threads:[~2006-07-21 14:55 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
2006-07-21 14:54 ` Alex Riesen [this message]
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=81b0412b0607210754m1e3c8bf9ne717786e666fa7e1@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=s022018@student.dtu.dk \
/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