fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

In openwall.com/lists/oss-securit I commented:

"Note that asprintf() and vasprintf() are part of the POSIX.1-2024 standard which was officially published last month, so these are no longer system-specific extensions:

pubs.opengroup.org/onlinepubs/
pubs.opengroup.org/onlinepubs/

though they are not yet part of the C standard itself."

To ask the committee to add them, I just had to submit austingroupbugs.net/view.php?i

I wish it was that easy to ask the C committee, instead of having to write a paper for it.

www.openwall.comoss-security - GStreamer Security Advisory 2024-0003: Orc compiler stack-based buffer overflow

As @solardiz noted in the followup post at openwall.com/lists/oss-securit the standard unfortunately allowed the GNU libc behavior of not guaranteeing the pointer would be NULL on failure, requiring users to check the return value, despite all the known non-GNU implementations guaranteeing to set it to NULL on failure, meaning that even though the standard requires asprintf() be provided, portable software still has to be aware of the different implementations.

www.openwall.comoss-security - Re: GStreamer Security Advisory 2024-0003: Orc compiler stack-based buffer overflow
@alanc @solardiz I guess as Ulrich Drepper pointed you'd need to check the return value before using *ptr, which makes a bit of sense to me although it's a footgun for asprintf to not make *ptr NULL in case of error.
At least I think it's doable for static analyzers to require error checking for asprintf and I guess if it gets into ISO C with the same problem, for compilers to do the check.
Alan Coopersmith

@lanodan certainly the GNU libc maintainers could add attribute(warn_unused_result) to the asprintf prototype in their header files if they want to insist on this.

@alanc Right, always forget about attributes, too used to using standards as sole target and documentation.
At least C23 (yet to be released) should add [[nodiscard]].