Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <886447e5-efb2-4701-83ef-2872bfd657e0@oracle.com>
Date: Fri, 26 Jul 2024 13:05:09 -0700
From: Alan Coopersmith <alan.coopersmith@...cle.com>
To: oss-security@...ts.openwall.com, Solar Designer <solar@...nwall.com>
Cc: sebastian@...tricular.com
Subject: Re: GStreamer Security Advisory 2024-0003: Orc
 compiler stack-based buffer overflow

On 7/26/24 12:46, Solar Designer wrote:
> Unfortunately, *asprintf() are not that easy to use safely:
> 
> "For asprintf(), if memory allocation was not possible, or if some other
> error occurs, the function shall return a negative value, and the
> contents of the location referenced by ptr are undefined, but shall not
> refer to allocated memory."
[...]
> As I recall, on *BSD's *asprintf() also reset the pointer to NULL.  On
> upstream glibc, it does not.  We failed to get this change past Ulrich
> back then:
> 
> https://sourceware.org/legacy-ml/libc-alpha/2001-12/msg00045.html

Yes, this came up in the discussion to add asprintf() to POSIX in
https://austingroupbugs.net/view.php?id=1496 :

> Of the above listed implementations, all but GNU libc document that they will
> set *ptr to NULL on error, while GNU libc explicitly states that you cannot
> rely on it to do so (and looking at its code, sometimes it does, sometimes
> it doesn't).

and so the standard was written to allow both ways to be conformant.

If GNU libc was willing to change that, perhaps the next version of the
standard could as well.

-- 
         -Alan Coopersmith-                 alan.coopersmith@...cle.com
          Oracle Solaris Engineering - https://blogs.oracle.com/solaris

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

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