git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unanticipated test error

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 21, 2006, 14:54 UTC
Message-ID
<81b0412b0607210754m1e3c8bf9ne717786e666fa7e1@mail.gmail.com>
In-Reply-To
<20060721081954.GA29645@bohr.gbar.dtu.dk>
On 7/21/06, Peter Eriksen <s022018@student.dtu.dk> wrote:
Show 17 quoted lines
> ...
> > 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.
Previous: Peter Eriksen
Message 4 of 4 in “Unanticipated test error”
  1. Peter EriksenJul 20, 2006
  2. Alex RiesenJul 21, 2006
  3. Peter EriksenJul 21, 2006
  4. Alex RiesenJul 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.