Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ms9jlcgw.fsf@gmail.com>
Date: Fri, 04 Jul 2025 17:15:27 -0700
From: Collin Funk <collin.funk1@...il.com>
To: Alejandro Colomar <alx@...nel.org>
Cc: Eric Blake <eblake@...hat.com>,  Rich Felker <dalias@...c.org>,  enh
 <enh@...gle.com>,  Florian Weimer <fweimer@...hat.com>,  Adhemerval
 Zanella Netto <adhemerval.zanella@...aro.org>,  musl@...ts.openwall.com,
  libc-alpha@...rceware.org,  Joseph Myers <josmyers@...hat.com>,
  наб
 <nabijaczleweli@...ijaczleweli.xyz>,  Paul Eggert <eggert@...ucla.edu>,
  Robert Seacord <rcseacord@...il.com>,  Bruno Haible <bruno@...sp.org>,
  bug-gnulib@....org,  JeanHeyd Meneide <phdofthehouse@...il.com>,
  Thorsten Glaser <tg@...bsd.de>
Subject: Re: Re: BUG: realloc(p,0) should be consistent with malloc(0)

Alejandro Colomar <alx@...nel.org> writes:

> BTW, I was trying to find out the history of memccpy(3), and why it was
> introduced in 4.4BSD.  Does anyone know the history?  I find it a weird
> function that doesn't have any good use case, or I don't seem to see it.
> Every use case I see, such as a poor-man's strlcpy(3), seems to be prone
> to off-by-one errors, or have other APIs that would be more ergonomic.
> What were the original uses in 4.4BSD?

In the sources for 2.11 BSD you can find the following in
include/strings.h:

    /* Routines described in memory(BA_LIB); System V compatibility */
    char	*memccpy(), *memchr(), *memcpy(), *memset(), *strchr(),
    	*strdup(), *strpbrk(), *strrchr(), *strsep(), *strtok();

The first time I can see the function defined is in Eigth Edition Unix.

You can look for yourself here, <https://www.tuhs.org/cgi-bin/utree.pl>.

Collin

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.