Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ymigejkdbyrxohd5chrigpfvztnia2nw4u3jmdiw6vke2xs3me@xb5t6hevzuba>
Date: Sat, 5 Jul 2025 01:31:22 +0200
From: Alejandro Colomar <alx@...nel.org>
To: Eric Blake <eblake@...hat.com>
Cc: 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)

Hi Eric,

On Fri, Jun 20, 2025 at 01:38:14AM +0200, Alejandro Colomar wrote:
> > > 		-  POSIX.1-2001
> > 
> > This one defers to C89 anywhere that it is not explicitly documenting
> > with CX shading.
> 
> Ahh, I had thought it would defer to C99 because it's older, but I guess
> it's like POSIX.1-2024 that doesn't defer to C23.  Thanks!  Then I stand
> corrected, and glibc conforms to POSIX.1-2001.

I was reading the memccpy(3) specification in POSIX.1-2004, and found
this:

	Issue 6

		The restrict keyword is added to the memccpy() prototype
		for alignment with the ISO/IEC 9899:1999 standard.

So, Issue 6 aligned with ISO C99?  Is this exceptional, or does then
POSIX.1-2001 not defer to ISO C89?

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?


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es/>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

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.